-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add subscribe to parent comment action menu #27994
Changes from all commits
45b9054
58f417f
f48336d
0b7a83e
133ed16
c3df845
6e74722
bad56fe
f016bb8
9beba29
341d267
e6851b3
d30f297
28105ea
3202977
c7a0c60
8a609fd
db19896
9865290
37f5d27
e93d6dd
6caf051
c4182b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,83 @@ export default [ | |
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.subscribeToThread', | ||
icon: Expensicons.Bell, | ||
successTextTranslateKey: '', | ||
successIcon: null, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { | ||
let childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); | ||
if (!childReportNotificationPreference) { | ||
const isActionCreator = ReportUtils.isActionCreator(reportAction); | ||
childReportNotificationPreference = isActionCreator ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; | ||
} | ||
const subscribed = childReportNotificationPreference !== 'hidden'; | ||
const isCommentAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && !ReportUtils.isThreadFirstChat(reportAction, reportID); | ||
const isReportPreviewAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming from #35092, we shouldn’t display the leave thread option for IOU previews |
||
const isIOUAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && !ReportActionsUtils.isSplitBillAction(reportAction); | ||
return !subscribed && (isCommentAction || isReportPreviewAction || isIOUAction); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we should not show this icon if the reportAction does not have a child since that does not make sense to me. Like whats the usecase to subscribe to a thread that does not exist? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above
|
||
}, | ||
onPress: (closePopover, {reportAction, reportID}) => { | ||
let childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); | ||
if (!childReportNotificationPreference) { | ||
const isActionCreator = ReportUtils.isActionCreator(reportAction); | ||
childReportNotificationPreference = isActionCreator ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; | ||
} | ||
if (closePopover) { | ||
hideContextMenu(false, () => { | ||
ReportActionComposeFocusManager.focus(); | ||
Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); | ||
}); | ||
return; | ||
} | ||
|
||
ReportActionComposeFocusManager.focus(); | ||
Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.unsubscribeFromThread', | ||
icon: Expensicons.BellSlash, | ||
successTextTranslateKey: '', | ||
successIcon: null, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { | ||
let childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); | ||
if (!childReportNotificationPreference) { | ||
const isActionCreator = ReportUtils.isActionCreator(reportAction); | ||
childReportNotificationPreference = isActionCreator ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; | ||
} | ||
const subscribed = childReportNotificationPreference !== 'hidden'; | ||
if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { | ||
return false; | ||
} | ||
const isCommentAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && !ReportUtils.isThreadFirstChat(reportAction, reportID); | ||
const isReportPreviewAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW; | ||
const isIOUAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && !ReportActionsUtils.isSplitBillAction(reportAction); | ||
return subscribed && (isCommentAction || isReportPreviewAction || isIOUAction); | ||
}, | ||
onPress: (closePopover, {reportAction, reportID}) => { | ||
let childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); | ||
if (!childReportNotificationPreference) { | ||
const isActionCreator = ReportUtils.isActionCreator(reportAction); | ||
childReportNotificationPreference = isActionCreator ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; | ||
} | ||
if (closePopover) { | ||
hideContextMenu(false, () => { | ||
ReportActionComposeFocusManager.focus(); | ||
Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); | ||
}); | ||
return; | ||
} | ||
|
||
ReportActionComposeFocusManager.focus(); | ||
Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: true, | ||
textTranslateKey: 'reportActionContextMenu.copyURLToClipboard', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is weird to me. I think we should return early if childReportID is 0. I don't understand why anyone would want to subscribe to a thread prematurely i.e., when a thread does not exist yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we talked about it briefly and I asked about it here which led to this change. It's basically like slack where you can
Get notified about new replies
.