Skip to content

Commit 8761aa6

Browse files
committed
Update to reflect recent standards and Web-E changes
1 parent 3686169 commit 8761aa6

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

src/libs/actions/Report.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ function addComment(reportID, text, file) {
919919
isFirstItem: false,
920920
isAttachment,
921921
attachmentInfo,
922-
isPending: true,
922+
isLoading: true,
923923
shouldShow: true,
924924
},
925925
};
@@ -961,15 +961,15 @@ function addComment(reportID, text, file) {
961961
DateUtils.setTimezoneUpdated();
962962
}
963963

964-
API.write(isAttachment ? 'AddAttachmentWithOptionalComment' : 'AddComment', parameters, {
964+
API.write(isAttachment ? 'AddAttachment' : 'AddComment', parameters, {
965965
optimisticData,
966966
failureData: [
967967
{
968968
onyxMethod: CONST.ONYX.METHOD.MERGE,
969969
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
970970
value: {
971971
[optimisticReportActionID]: {
972-
isPending: false,
972+
isLoading: false,
973973
},
974974
},
975975
},
@@ -981,7 +981,7 @@ function addComment(reportID, text, file) {
981981
* @param {Number} reportID
982982
* @param {Object} file
983983
*/
984-
function addAttachmentWithOptionalComment(reportID, file) {
984+
function addAttachment(reportID, file) {
985985
addComment(reportID, '', file);
986986
}
987987

@@ -1494,7 +1494,7 @@ export {
14941494
fetchIOUReportByID,
14951495
fetchIOUReportByIDAndUpdateChatReport,
14961496
addComment,
1497-
addAttachmentWithOptionalComment,
1497+
addAttachment,
14981498
updateLastReadActionID,
14991499
updateNotificationPreference,
15001500
setNewMarkerPosition,

src/libs/actions/ReportActions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Onyx.connect({
3434
const reportID = CollectionUtils.extractCollectionItemID(key);
3535
const actionsArray = _.toArray(actions);
3636
reportActions[reportID] = actionsArray;
37-
const mostRecentNonLoadingActionIndex = _.findLastIndex(actionsArray, action => !action.isPending);
37+
const mostRecentNonLoadingActionIndex = _.findLastIndex(actionsArray, action => !action.isLoading);
3838
const mostRecentAction = actionsArray[mostRecentNonLoadingActionIndex];
3939
if (!mostRecentAction || _.isUndefined(mostRecentAction.sequenceNumber)) {
4040
return;

src/pages/home/report/ReportActionCompose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ class ReportActionCompose extends React.Component {
495495
headerTitle={this.props.translate('reportActionCompose.sendAttachment')}
496496
onConfirm={(file) => {
497497
this.submitForm();
498-
Report.createAttachment(this.props.reportID, file);
498+
Report.addAttachment(this.props.reportID, file);
499499
this.setTextInputShouldClear(false);
500500
}}
501501
>

src/pages/home/report/ReportActionItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class ReportActionItem extends Component {
175175
hovered
176176
|| this.state.isContextMenuActive
177177
|| this.props.draftMessage,
178-
(this.props.network.isOffline && this.props.action.isPending) || this.props.action.error,
178+
(this.props.network.isOffline && this.props.action.isLoading) || this.props.action.error,
179179
)}
180180
>
181181
{!this.props.displayAsGroup

src/pages/home/report/ReportActionItemMessage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const propTypes = {
2222
};
2323

2424
const ReportActionItemMessage = (props) => {
25-
const isUnsent = props.network.isOffline && props.action.isPending;
25+
const isUnsent = props.network.isOffline && props.action.isLoading;
2626

2727
return (
2828
<View style={[styles.chatItemMessage, isUnsent && styles.chatItemUnsentMessage]}>
@@ -32,7 +32,7 @@ const ReportActionItemMessage = (props) => {
3232
fragment={fragment}
3333
isAttachment={props.action.isAttachment}
3434
attachmentInfo={props.action.attachmentInfo}
35-
loading={props.action.isPending}
35+
loading={props.action.isLoading}
3636
/>
3737
))}
3838
</View>

src/pages/home/report/ReportActionItemSingle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const ReportActionItemSingle = (props) => {
9292
fragment={fragment}
9393
tooltipText={props.action.actorEmail}
9494
isAttachment={props.action.isAttachment}
95-
isLoading={props.action.isPending}
95+
isLoading={props.action.isLoading}
9696
isSingleLine
9797
/>
9898
))}

src/pages/home/report/reportActionPropTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default {
2525
}),
2626

2727
/** Whether we have received a response back from the server */
28-
isPending: PropTypes.bool,
28+
isLoading: PropTypes.bool,
2929

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

src/styles/StyleUtils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,10 @@ function getLoginPagePromoStyle() {
387387
* Generate the styles for the ReportActionItem wrapper view.
388388
*
389389
* @param {Boolean} [isHovered]
390-
* @param {Boolean} [isPending]
390+
* @param {Boolean} [isLoading]
391391
* @returns {Object}
392392
*/
393-
function getReportActionItemStyle(isHovered = false, isPending = false) {
393+
function getReportActionItemStyle(isHovered = false, isLoading = false) {
394394
return {
395395
display: 'flex',
396396
justifyContent: 'space-between',
@@ -399,7 +399,7 @@ function getReportActionItemStyle(isHovered = false, isPending = false) {
399399

400400
// Warning: Setting this to a non-transparent color will cause unread indicator to break on Android
401401
: colors.transparent,
402-
opacity: isPending ? 0.5 : 1,
402+
opacity: isLoading ? 0.5 : 1,
403403
cursor: 'default',
404404
};
405405
}

tests/actions/ReportTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe('actions/Report', () => {
101101
clientID = resultAction.sequenceNumber;
102102
expect(resultAction.message).toEqual(REPORT_ACTION.message);
103103
expect(resultAction.person).toEqual(REPORT_ACTION.person);
104-
expect(resultAction.isPending).toEqual(true);
104+
expect(resultAction.isLoading).toEqual(true);
105105

106106
// We subscribed to the Pusher channel above and now we need to simulate a reportComment action
107107
// Pusher event so we can verify that action was handled correctly and merged into the reportActions.
@@ -141,7 +141,7 @@ describe('actions/Report', () => {
141141
const resultAction = reportActions[ACTION_ID];
142142

143143
// Verify that our action is no longer in the loading state
144-
expect(resultAction.isPending).not.toBeDefined();
144+
expect(resultAction.isLoading).not.toBeDefined();
145145
});
146146
});
147147

0 commit comments

Comments
 (0)