Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused attachment placeholder code #25557

Merged
merged 11 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ function ReportActionItem(props) {
<View
style={StyleUtils.getReportActionItemStyle(
hovered || isWhisper || isContextMenuActive || props.draftMessage,
(props.network.isOffline && props.action.isLoading) || props.action.error,
cubuspl42 marked this conversation as resolved.
Show resolved Hide resolved
props.action.error,
)}
>
<OfflineWithFeedback
Expand Down
19 changes: 0 additions & 19 deletions src/pages/home/report/ReportActionItemFragment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, {memo} from 'react';
import {ActivityIndicator, View} from 'react-native';
import PropTypes from 'prop-types';
import Str from 'expensify-common/lib/str';
import reportActionFragmentPropTypes from './reportActionFragmentPropTypes';
Expand Down Expand Up @@ -29,7 +28,7 @@
fragment: reportActionFragmentPropTypes.isRequired,

/** Is this fragment an attachment? */
isAttachment: PropTypes.bool,

Check failure on line 31 in src/pages/home/report/ReportActionItemFragment.js

View workflow job for this annotation

GitHub Actions / lint

'isAttachment' PropType is defined but prop is never used

/** If this fragment is attachment than has info? */
attachmentInfo: PropTypes.shape({
Expand All @@ -46,9 +45,6 @@
source: PropTypes.string,
}),

/** Does this fragment belong to a reportAction that has not yet loaded? */
loading: PropTypes.bool,

/** The reportAction's source */
source: PropTypes.oneOf(['Chronos', 'email', 'ios', 'android', 'web', 'email', '']),

Expand Down Expand Up @@ -78,7 +74,6 @@
type: '',
source: '',
},
loading: false,
isSingleLine: false,
source: '',
style: [],
Expand All @@ -89,20 +84,6 @@
function ReportActionItemFragment(props) {
switch (props.fragment.type) {
case 'COMMENT': {
// If this is an attachment placeholder, return the placeholder component
if (props.isAttachment && props.loading) {
return Str.isImage(props.attachmentInfo.name) ? (
<RenderHTML html={`<comment><img src="${props.attachmentInfo.source}" data-expensify-preview-modal-disabled="true"/></comment>`} />
) : (
<View style={[styles.chatItemAttachmentPlaceholder]}>
<ActivityIndicator
size="large"
color={themeColors.textSupporting}
style={[styles.flex1]}
/>
</View>
);
}
const {html, text} = props.fragment;

// Threaded messages display "[Deleted message]" instead of being hidden altogether.
Expand Down
1 change: 0 additions & 1 deletion src/pages/home/report/ReportActionItemMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function ReportActionItemMessage(props) {
pendingAction={props.action.pendingAction}
source={lodashGet(props.action, 'originalMessage.source')}
accountID={props.action.actorAccountID}
loading={props.action.isLoading}
style={props.style}
/>
))
Expand Down
1 change: 0 additions & 1 deletion src/pages/home/report/ReportActionItemSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ function ReportActionItemSingle(props) {
accountID={actorAccountID}
fragment={fragment}
isAttachment={props.action.isAttachment}
isLoading={props.action.isLoading}
delegateAccountID={props.action.delegateAccountID}
isSingleLine
actorIcon={icon}
Expand Down
3 changes: 0 additions & 3 deletions src/pages/home/report/reportActionPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export default {
IOUTransactionID: PropTypes.string,
}),

/** Whether we have received a response back from the server */
isLoading: PropTypes.bool,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcaaron Any thoughts? You are to blame for this line 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searched for isLoading and "isLoading" in the frontend code-base and I couldn't find any set of this property in the context of report actions.


/** Error message that's come back from the server. */
error: PropTypes.string,

Expand Down
6 changes: 3 additions & 3 deletions src/styles/StyleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,18 +637,18 @@ function getLoginPagePromoStyle() {
* Generate the styles for the ReportActionItem wrapper view.
*
* @param {Boolean} [isHovered]
* @param {Boolean} [isLoading]
* @param {Boolean} [hasError]
flodnv marked this conversation as resolved.
Show resolved Hide resolved
* @returns {Object}
*/
function getReportActionItemStyle(isHovered = false, isLoading = false) {
function getReportActionItemStyle(isHovered = false, hasError = false) {
return {
display: 'flex',
justifyContent: 'space-between',
backgroundColor: isHovered
? themeColors.hoverComponentBG
: // Warning: Setting this to a non-transparent color will cause unread indicator to break on Android
colors.transparent,
opacity: isLoading ? 0.5 : 1,
opacity: hasError ? 0.5 : 1,
...styles.cursorInitial,
};
}
Expand Down
Loading