You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-08-01] [$1000] Dev: Web - Reaction does not work for first message of thread #22235
Hover on any message and click reply in thread option
In the thread, try to react on the first message
Expected Result:
Reaction should be able to be applied
Actual Result:
Reaction does not work
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.36-2 DEV Reproducible in staging?: n/a Reproducible in production?: n/a If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
When we call toggleEmojiReaction, because reportID is the current report but reportActionID is parent report action, reportAction is empty, and then this function return and do nothing.
What changes do you think we should make in order to solve the problem?
We should check if reportAction is empty that mean reportActionID is the ID of parent report action, we will get the parentReport, and get the correct reportAction.
function toggleEmojiReaction(reportID, reportActionID, emoji, paramSkinTone = preferredSkinTone) {
let currentReportID = reportID;
let reportAction = ReportActionsUtils.getReportAction(reportID, reportActionID);
if (_.isEmpty(reportAction)) {
const parentReport = ReportUtils.getParentReport(ReportUtils.getReport(reportID))
currentReportID = parentReport.reportID;
reportAction = ReportActionsUtils.getReportAction(currentReportID, reportActionID);
}
if (_.isEmpty(reportAction)) {
return;
}
const message = reportAction.message[0];
const reactionObject = message.reactions && _.find(message.reactions, (reaction) => reaction.emoji === emoji.name);
const skinTone = emoji.types === undefined ? null : paramSkinTone; // only use skin tone if emoji supports it
if (reactionObject) {
if (hasAccountIDReacted(currentUserAccountID, reactionObject.users, skinTone)) {
return removeEmojiReaction(currentReportID, reportAction, emoji, skinTone);
}
}
return addEmojiReaction(currentReportID, reportAction, emoji, skinTone);
}
What alternative solutions did you explore? (Optional)
In ReportActionItemParentAction, we provide a report action from a different report than the one provided via the report property. Namely, report is the child report (the thread) and the report action (passed via action property) is from the parent report.
ReportActionItem requires the report and the report action to be related.
In consequence, the toggleEmoji function is confused and does not work.
What changes do you think we should make in order to solve the problem?
The report we provide to ReportActionItem via the report property should be the report containing the report action passed via the reportAction property, as per the ReportActionItem contract.
functionReportActionItemParentAction(props){// ...return(<OfflineWithFeedback// ...><Viewstyle={StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth)}><Viewstyle={[styles.p5,StyleUtils.getReportWelcomeTopMarginStyle(props.isSmallScreenWidth)]}/>{parentReportAction&&(<ReportActionItem// Pass the parent reportreport={props.parentReport}action={parentReportAction}// ...// Don't show the preview of thread repliesshouldDisplayThreadReplies={false}// .../>)}</View>{/* ... */}</OfflineWithFeedback>);}// ...exportdefaultcompose(withWindowDimensions,withLocalize,withOnyx({report: {key: ({reportID})=>`${ONYXKEYS.COLLECTION.REPORT}${reportID}`,},// Get the parent report from OnyxparentReport: {key: ({parentReportID})=>`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`,},parentReportActions: {key: ({parentReportID})=>`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`,canEvict: false,},}),)(ReportActionItemParentAction);
changed the title [-]Dev: Web - Reaction does not work for first message of thread[/-][+][$1000] Dev: Web - Reaction does not work for first message of thread[/+]on Jul 5, 2023
Activity
melvin-bot commentedon Jul 5, 2023
Triggered auto assignment to @johncschuster (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 5, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)dukenv0307 commentedon Jul 5, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Reaction does not work for first message of thread
What is the root cause of that problem?
We pass
reportas child report andactionasparentReportActionintoReportActionItemApp/src/pages/home/report/ReportActionItemParentAction.js
Lines 64 to 70 in 15e547e
When we call
toggleEmojiReaction, becausereportIDis the current report butreportActionIDis parent report action,reportActionis empty, and then this function return and do nothing.App/src/libs/actions/Report.js
Lines 1644 to 1648 in 15e547e
What changes do you think we should make in order to solve the problem?
We should check if
reportActionis empty that meanreportActionIDis the ID of parent report action, we will get the parentReport, and get the correct reportAction.What alternative solutions did you explore? (Optional)
NA
Result
Screencast.from.05-07-2023.15.30.37.webm
jakub-trzebiatowski commentedon Jul 5, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Reacting with emoji does not work for first message in a thread.
What is the root cause of that problem?
This is a regression from #21933.
In
ReportActionItemParentAction, we provide a report action from a different report than the one provided via thereportproperty. Namely,reportis the child report (the thread) and the report action (passed viaactionproperty) is from the parent report.ReportActionItemrequires the report and the report action to be related.App/src/pages/home/report/ReportActionItem.js
Lines 63 to 67 in 15e547e
In consequence, the
toggleEmojifunction is confused and does not work.What changes do you think we should make in order to solve the problem?
The report we provide to
ReportActionItemvia thereportproperty should be the report containing the report action passed via thereportActionproperty, as per theReportActionItemcontract.My branch
[-]Dev: Web - Reaction does not work for first message of thread[/-][+][$1000] Dev: Web - Reaction does not work for first message of thread[/+]melvin-bot commentedon Jul 5, 2023
Job added to Upwork: https://www.upwork.com/jobs/~019314fb87cf5420e8
melvin-bot commentedon Jul 5, 2023
Current assignee @johncschuster is eligible for the External assigner, not assigning anyone new.
47 remaining items
neil-marcellini commentedon Aug 9, 2023
Not overdue on my side
johncschuster commentedon Aug 14, 2023
Eep! I'm sorry I let this one slip! Working on payment now!
aimane-chnaif commentedon Aug 15, 2023
Here's timeline analysis:
@jeet-dhandha was not assigned on this issue, but they took responsibility of fixing this as this came from their original PR.
melvin-bot commentedon Aug 21, 2023
@johncschuster, @neil-marcellini, @aimane-chnaif Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Aug 22, 2023
@johncschuster, @neil-marcellini, @aimane-chnaif 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
melvin-bot commentedon Aug 24, 2023
@johncschuster, @neil-marcellini, @aimane-chnaif Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
melvin-bot commentedon Aug 28, 2023
@johncschuster, @neil-marcellini, @aimane-chnaif 12 days overdue. Walking. Toward. The. Light...
neil-marcellini commentedon Aug 28, 2023
Now that we have a specific issue for payment I'm going to close this.