From 45b90544c39d8bdaa5c0fdaea999d3a3d95f31e1 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 21 Sep 2023 13:07:56 +0800 Subject: [PATCH 01/19] boilerplate for changes --- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/libs/actions/Report.js | 36 +++++++++++++++++++ .../report/ContextMenu/ContextMenuActions.js | 28 +++++++++++++++ 4 files changed, 66 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 1882b7e97afb..30f6b0c68f8e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -396,6 +396,7 @@ export default { deleteConfirmation: ({action}: DeleteConfirmationParams) => `Are you sure you want to delete this ${ReportActionsUtils.isMoneyRequestAction(action) ? 'request' : 'comment'}?`, onlyVisible: 'Only visible to', replyInThread: 'Reply in thread', + subscribeToThread: 'Subscribe to thread', flagAsOffensive: 'Flag as offensive', }, emojiReactions: { diff --git a/src/languages/es.ts b/src/languages/es.ts index 87c7a19fed8a..f2786057e107 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -387,6 +387,7 @@ export default { deleteConfirmation: ({action}: DeleteConfirmationParams) => `¿Estás seguro de que quieres eliminar este ${ReportActionsUtils.isMoneyRequestAction(action) ? 'pedido' : 'comentario'}`, onlyVisible: 'Visible sólo para', replyInThread: 'Responder en el hilo', + subscribeToThread: 'NEED TO TRANSLATE', flagAsOffensive: 'Marcar como ofensivo', }, emojiReactions: { diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 55b03110e925..61d6df634dca 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -630,6 +630,42 @@ function navigateToAndOpenChildReport(childReportID = '0', parentReportAction = } } +/** + * This will subscribe to an existing thread, or create a new one and then subsribe to it if necessary + * + * @param {String} childReportID The reportID we are trying to open + * @param {Object} parentReportAction the parent comment of a thread + * @param {String} parentReportID The reportID of the parent + * + */ +function subscribeToChildReport(childReportID = '0', parentReportAction = {}, parentReportID = '0') { + if (childReportID !== '0') { + openReport(childReportID); + Navigation.navigate(ROUTES.getReportRoute(childReportID)); + } else { + const participantAccountIDs = _.uniq([currentUserAccountID, Number(parentReportAction.actorAccountID)]); + const parentReport = allReports[parentReportID]; + const newChat = ReportUtils.buildOptimisticChatReport( + participantAccountIDs, + lodashGet(parentReportAction, ['message', 0, 'text']), + lodashGet(parentReport, 'chatType', ''), + lodashGet(parentReport, 'policyID', CONST.POLICY.OWNER_EMAIL_FAKE), + CONST.POLICY.OWNER_ACCOUNT_ID_FAKE, + false, + '', + undefined, + undefined, + CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, + parentReportAction.reportActionID, + parentReportID, + ); + + const participantLogins = PersonalDetailsUtils.getLoginsByAccountIDs(newChat.participantAccountIDs); + openReport(newChat.reportID, participantLogins, newChat, parentReportAction.reportActionID); + Navigation.navigate(ROUTES.getReportRoute(newChat.reportID)); + } +} + /** * Get the latest report history without marking the report as read. * diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 173bda0e5221..6e7256162be6 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -146,6 +146,34 @@ export default [ }, getDescription: () => {}, }, + { + isAnonymousAction: false, + textTranslateKey: 'reportActionContextMenu.subscribeToThread', + icon: Expensicons.ChatBubble, + successTextTranslateKey: '', + successIcon: null, + shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { + 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 isCommentAction || isReportPreviewAction || isIOUAction; + }, + onPress: (closePopover, {reportAction, reportID}) => { + if (closePopover) { + hideContextMenu(false, () => { + ReportActionComposeFocusManager.focus(); + Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); + }); + return; + } + + Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); + }, + getDescription: () => {}, + }, { isAnonymousAction: false, textTranslateKey: 'reportActionContextMenu.copyURLToClipboard', From 58f417f8039a4d6faab3d0ee6254582beada2fd3 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Fri, 22 Sep 2023 16:19:47 +0800 Subject: [PATCH 02/19] intermediate changes --- src/libs/actions/Report.js | 33 +++++++++++++++++-- .../report/ContextMenu/ContextMenuActions.js | 22 +++++++------ 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 61d6df634dca..c2dd3daf49b1 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -638,10 +638,11 @@ function navigateToAndOpenChildReport(childReportID = '0', parentReportAction = * @param {String} parentReportID The reportID of the parent * */ -function subscribeToChildReport(childReportID = '0', parentReportAction = {}, parentReportID = '0') { +function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = {}, parentReportID = '0', prevNotificationPreference) { if (childReportID !== '0') { openReport(childReportID); - Navigation.navigate(ROUTES.getReportRoute(childReportID)); + if (prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE) + updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, ) } else { const participantAccountIDs = _.uniq([currentUserAccountID, Number(parentReportAction.actorAccountID)]); const parentReport = allReports[parentReportID]; @@ -1241,6 +1242,32 @@ function saveReportActionDraftNumberOfLines(reportID, reportActionID, numberOfLi Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${reportID}_${reportActionID}`, numberOfLines); } +/** + * @param {String} reportID + * @param {String} previousValue + * @param {String} newValue + */ +function updateNotificationPreference(reportID, previousValue, newValue) { + if (previousValue === newValue) { + return; + } + const optimisticData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, + value: {notificationPreference: newValue}, + }, + ]; + const failureData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, + value: {notificationPreference: previousValue}, + }, + ]; + API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); +} + /** * @param {String} reportID * @param {String} previousValue @@ -2105,6 +2132,7 @@ export { reconnect, updateWelcomeMessage, updateWriteCapabilityAndNavigate, + updateNotificationPreference, updateNotificationPreferenceAndNavigate, subscribeToReportTypingEvents, unsubscribeFromReportChannel, @@ -2132,6 +2160,7 @@ export { navigateToAndOpenReport, navigateToAndOpenReportWithAccountIDs, navigateToAndOpenChildReport, + toggleSubscribeToChildReport, updatePolicyRoomNameAndNavigate, clearPolicyRoomNameErrors, clearIOUError, diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 6e7256162be6..61bf5abe4674 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -25,6 +25,7 @@ import * as Task from '../../../../libs/actions/Task'; import * as Localize from '../../../../libs/Localize'; import * as TransactionUtils from '../../../../libs/TransactionUtils'; import * as CurrencyUtils from '../../../../libs/CurrencyUtils'; +import Log from '../../../../libs/Log'; /** * Gets the HTML version of the message in an action. @@ -149,7 +150,7 @@ export default [ { isAnonymousAction: false, textTranslateKey: 'reportActionContextMenu.subscribeToThread', - icon: Expensicons.ChatBubble, + icon: Expensicons.Chair, successTextTranslateKey: '', successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { @@ -162,15 +163,16 @@ export default [ return isCommentAction || isReportPreviewAction || isIOUAction; }, onPress: (closePopover, {reportAction, reportID}) => { - if (closePopover) { - hideContextMenu(false, () => { - ReportActionComposeFocusManager.focus(); - Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); - }); - return; - } - - Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); + Log.info("sparsisparsi start"); + Log.info(JSON.stringify(reportAction)); + Log.info("sparsisparsi done"); + // if (closePopover) { + // hideContextMenu(false, () => { + // ReportActionComposeFocusManager.focus(); + // Report.subscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); + // }); + // return; + // } }, getDescription: () => {}, }, From 0b7a83e8edd8e44971226f86f55c81140b20fc76 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 28 Sep 2023 18:22:10 +0800 Subject: [PATCH 03/19] icons and frontend wip --- assets/images/bell.svg | 3 ++ assets/images/bellSlash.svg | 3 ++ ios/NewExpensify.xcodeproj/project.pbxproj | 18 +++++++- ios/tmp.xcconfig | 10 ++++- src/components/Icon/Expensicons.js | 4 ++ src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/libs/actions/Report.js | 1 + .../report/ContextMenu/ContextMenuActions.js | 43 +++++++++++++++++-- 9 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 assets/images/bell.svg create mode 100644 assets/images/bellSlash.svg diff --git a/assets/images/bell.svg b/assets/images/bell.svg new file mode 100644 index 000000000000..a53c9508cbd6 --- /dev/null +++ b/assets/images/bell.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/bellSlash.svg b/assets/images/bellSlash.svg new file mode 100644 index 000000000000..2cacb07f4268 --- /dev/null +++ b/assets/images/bellSlash.svg @@ -0,0 +1,3 @@ + + + diff --git a/ios/NewExpensify.xcodeproj/project.pbxproj b/ios/NewExpensify.xcodeproj/project.pbxproj index 64ed3fda8b02..d1cd2d066833 100644 --- a/ios/NewExpensify.xcodeproj/project.pbxproj +++ b/ios/NewExpensify.xcodeproj/project.pbxproj @@ -29,7 +29,7 @@ 70CF6E82262E297300711ADC /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 70CF6E81262E297300711ADC /* BootSplash.storyboard */; }; BDB853621F354EBB84E619C2 /* ExpensifyNewKansas-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = D2AFB39EC1D44BF9B91D3227 /* ExpensifyNewKansas-MediumItalic.otf */; }; DD79042B2792E76D004484B4 /* RCTBootSplash.m in Sources */ = {isa = PBXBuildFile; fileRef = DD79042A2792E76D004484B4 /* RCTBootSplash.m */; }; - E51DC681C7DEE40AEBDDFBFE /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; + E51DC681C7DEE40AEBDDFBFE /* (null) in Frameworks */ = {isa = PBXBuildFile; }; E9DF872D2525201700607FDC /* AirshipConfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = E9DF872C2525201700607FDC /* AirshipConfig.plist */; }; ED222ED90E074A5481A854FA /* ExpensifyNeue-BoldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 8B28D84EF339436DBD42A203 /* ExpensifyNeue-BoldItalic.otf */; }; F0C450EA2705020500FD2970 /* colors.json in Resources */ = {isa = PBXBuildFile; fileRef = F0C450E92705020500FD2970 /* colors.json */; }; @@ -124,7 +124,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E51DC681C7DEE40AEBDDFBFE /* BuildFile in Frameworks */, + E51DC681C7DEE40AEBDDFBFE /* (null) in Frameworks */, 5A464BC8112CDB1DE1E38F1C /* libPods-NewExpensify.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -722,9 +722,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = NewExpensify/Chat.entitlements; CODE_SIGN_IDENTITY = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; ENABLE_BITCODE = NO; INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -738,6 +740,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.dev; PRODUCT_NAME = "New Expensify Dev"; PROVISIONING_PROFILE_SPECIFIER = expensify_chat_dev; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_dev; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -754,9 +757,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = NewExpensify/Chat.entitlements; CODE_SIGN_IDENTITY = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; INFOPLIST_FILE = NewExpensify/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -769,6 +774,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.dev; PRODUCT_NAME = "New Expensify Dev"; PROVISIONING_PROFILE_SPECIFIER = expensify_chat_dev; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_dev; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; @@ -976,6 +982,7 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; ENABLE_BITCODE = NO; INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -989,6 +996,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.chat.expensify.chat; PRODUCT_NAME = "New Expensify"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = chat_expensify_appstore; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1098,6 +1106,7 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; ENABLE_BITCODE = NO; INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1111,6 +1120,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.adhoc; PRODUCT_NAME = "New Expensify AdHoc"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_adhoc; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1214,6 +1224,7 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; INFOPLIST_FILE = NewExpensify/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1226,6 +1237,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.chat.expensify.chat; PRODUCT_NAME = "New Expensify"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = chat_expensify_appstore; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; @@ -1326,6 +1338,7 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; INFOPLIST_FILE = NewExpensify/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1338,6 +1351,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.adhoc; PRODUCT_NAME = "New Expensify AdHoc"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_adhoc; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; diff --git a/ios/tmp.xcconfig b/ios/tmp.xcconfig index 8b137891791f..2f2502669450 100644 --- a/ios/tmp.xcconfig +++ b/ios/tmp.xcconfig @@ -1 +1,9 @@ - +NEW_EXPENSIFY_URL=https:/$()/new.expensify.com/ +SECURE_EXPENSIFY_URL=https:/$()/secure.expensify.com/ +EXPENSIFY_URL=https:/$()/www.expensify.com/ +EXPENSIFY_PARTNER_NAME=chat-expensify-com +EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66 +PUSHER_APP_KEY=268df511a204fbb60884 +USE_WEB_PROXY=false +ENVIRONMENT=production +SEND_CRASH_REPORTS=true diff --git a/src/components/Icon/Expensicons.js b/src/components/Icon/Expensicons.js index a0c8b72d755a..0eea0ca7398c 100644 --- a/src/components/Icon/Expensicons.js +++ b/src/components/Icon/Expensicons.js @@ -9,6 +9,8 @@ import ArrowRightLong from '../../../assets/images/arrow-right-long.svg'; import ArrowsUpDown from '../../../assets/images/arrows-updown.svg'; import BackArrow from '../../../assets/images/back-left.svg'; import Bank from '../../../assets/images/bank.svg'; +import Bell from '../../../assets/images/bell.svg'; +import BellSlash from '../../../assets/images/bellSlash.svg'; import Bill from '../../../assets/images/bill.svg'; import Bolt from '../../../assets/images/bolt.svg'; import Briefcase from '../../../assets/images/briefcase.svg'; @@ -138,6 +140,8 @@ export { BackArrow, Bank, Bill, + Bell, + BellSlash, Bolt, Briefcase, Bug, diff --git a/src/languages/en.ts b/src/languages/en.ts index 53b9bab98ced..e038acf7a862 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -400,6 +400,7 @@ export default { onlyVisible: 'Only visible to', replyInThread: 'Reply in thread', subscribeToThread: 'Subscribe to thread', + unsubscribeFromThread: 'Unsubscribe from thread', flagAsOffensive: 'Flag as offensive', }, emojiReactions: { diff --git a/src/languages/es.ts b/src/languages/es.ts index 4eead6ddc0f3..c577e8f4b7ce 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -391,6 +391,7 @@ export default { onlyVisible: 'Visible sólo para', replyInThread: 'Responder en el hilo', subscribeToThread: 'NEED TO TRANSLATE', + unsubscribeFromThread: 'NEED TO TRANSLATE', flagAsOffensive: 'Marcar como ofensivo', }, emojiReactions: { diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index ecb98548d5e1..4d9b74a5a69f 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -706,6 +706,7 @@ function navigateToAndOpenChildReport(childReportID = '0', parentReportAction = * @param {String} childReportID The reportID we are trying to open * @param {Object} parentReportAction the parent comment of a thread * @param {String} parentReportID The reportID of the parent + * @param {String} prevNotificationPreference The previous notification preference for the child report * */ function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = {}, parentReportID = '0', prevNotificationPreference) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 1e603e40a99e..3fd39ddf25c0 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -138,7 +138,7 @@ export default [ if (closePopover) { hideContextMenu(false, () => { ReportActionComposeFocusManager.focus(); - Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); + Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', ''), reportAction, reportID); }); return; } @@ -150,22 +150,57 @@ export default [ { isAnonymousAction: false, textTranslateKey: 'reportActionContextMenu.subscribeToThread', - icon: Expensicons.Chair, + // textTranslateKey: lodashGet(reportAction, 'childReportNotificationPreference', '0'), + icon: Expensicons.Bell, + successTextTranslateKey: '', + successIcon: null,g + shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { + const subscribed = lodashGet(reportAction, '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}) => { + Log.info("sparsisparsi start"); + Log.info(lodashGet(reportAction, 'childReportNotificationPreference', '0')); + Log.info("sparsisparsi done"); + debugger; + // if (closePopover) { + // hideContextMenu(false, () => { + // ReportActionComposeFocusManager.focus(); + // Report.subscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); + // }); + // return; + // } + }, + getDescription: () => {}, + }, + { + isAnonymousAction: false, + textTranslateKey: 'reportActionContextMenu.unsubscribeFromThread', + // textTranslateKey: lodashGet(reportAction, 'childReportNotificationPreference', '0'), + icon: Expensicons.BellSlash, successTextTranslateKey: '', successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { + const subscribed = lodashGet(reportAction, 'childReportNotificationPreference', '0') !== "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 isCommentAction || isReportPreviewAction || isIOUAction; + return subscribed && (isCommentAction || isReportPreviewAction || isIOUAction); }, onPress: (closePopover, {reportAction, reportID}) => { Log.info("sparsisparsi start"); - Log.info(JSON.stringify(reportAction)); + Log.info(lodashGet(reportAction, 'childReportNotificationPreference', '0')); Log.info("sparsisparsi done"); + debugger; // if (closePopover) { // hideContextMenu(false, () => { // ReportActionComposeFocusManager.focus(); From c3df845adfe24f1377d7d9ca03fdb21b476ea566 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Wed, 11 Oct 2023 23:07:57 -0400 Subject: [PATCH 04/19] resolve merge conflicts --- src/pages/home/report/ContextMenu/ContextMenuActions.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 01b4e5a64b04..0c2ace646cdb 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -148,13 +148,12 @@ export default [ getDescription: () => {}, }, { -<<<<<<< HEAD isAnonymousAction: false, textTranslateKey: 'reportActionContextMenu.subscribeToThread', // textTranslateKey: lodashGet(reportAction, 'childReportNotificationPreference', '0'), icon: Expensicons.Bell, successTextTranslateKey: '', - successIcon: null,g + successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { const subscribed = lodashGet(reportAction, 'childReportNotificationPreference', '') !== "hidden"; if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { @@ -213,10 +212,7 @@ export default [ getDescription: () => {}, }, { - isAnonymousAction: false, -======= isAnonymousAction: true, ->>>>>>> main textTranslateKey: 'reportActionContextMenu.copyURLToClipboard', icon: Expensicons.Copy, successTextTranslateKey: 'reportActionContextMenu.copied', From 6e747221a7e920e7e5ec8fe4670574c5dc488402 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 17 Oct 2023 03:06:31 -0400 Subject: [PATCH 05/19] re-add functionality --- src/libs/actions/Report.js | 2 +- .../report/ContextMenu/ContextMenuActions.js | 50 ++++++++++--------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index af052c717425..c9ab02f127f4 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1351,7 +1351,7 @@ function updateNotificationPreference(reportID, previousValue, newValue, navigat function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = {}, parentReportID = '0', prevNotificationPreference) { if (childReportID !== '0') { openReport(childReportID); - if (prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { + if (!prevNotificationPreference || prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false) } else { updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, false) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 0c2ace646cdb..468c06326064 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -155,7 +155,8 @@ export default [ successTextTranslateKey: '', successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { - const subscribed = lodashGet(reportAction, 'childReportNotificationPreference', '') !== "hidden"; + const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); + const subscribed = childReportNotificationPreference && (childReportNotificationPreference !== "hidden"); if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { return false; } @@ -165,17 +166,17 @@ export default [ return !subscribed && (isCommentAction || isReportPreviewAction || isIOUAction); }, onPress: (closePopover, {reportAction, reportID}) => { - Log.info("sparsisparsi start"); - Log.info(lodashGet(reportAction, 'childReportNotificationPreference', '0')); - Log.info("sparsisparsi done"); - debugger; - // if (closePopover) { - // hideContextMenu(false, () => { - // ReportActionComposeFocusManager.focus(); - // Report.subscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); - // }); - // return; - // } + const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); + if (closePopover) { + hideContextMenu(false, () => { + ReportActionComposeFocusManager.focus(); + Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); + }); + return; + } else { + ReportActionComposeFocusManager.focus(); + Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); + } }, getDescription: () => {}, }, @@ -187,7 +188,8 @@ export default [ successTextTranslateKey: '', successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { - const subscribed = lodashGet(reportAction, 'childReportNotificationPreference', '0') !== "hidden"; + const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); + const subscribed = childReportNotificationPreference && (childReportNotificationPreference !== "hidden"); if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { return false; } @@ -197,17 +199,17 @@ export default [ return subscribed && (isCommentAction || isReportPreviewAction || isIOUAction); }, onPress: (closePopover, {reportAction, reportID}) => { - Log.info("sparsisparsi start"); - Log.info(lodashGet(reportAction, 'childReportNotificationPreference', '0')); - Log.info("sparsisparsi done"); - debugger; - // if (closePopover) { - // hideContextMenu(false, () => { - // ReportActionComposeFocusManager.focus(); - // Report.subscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); - // }); - // return; - // } + const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); + if (closePopover) { + hideContextMenu(false, () => { + ReportActionComposeFocusManager.focus(); + Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); + }); + return; + } else { + ReportActionComposeFocusManager.focus(); + Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); + } }, getDescription: () => {}, }, From bad56feb0f2c0e2a618a90eab0c29dca631835c2 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 17 Oct 2023 03:17:37 -0400 Subject: [PATCH 06/19] lint --- assets/images/bell.svg | 7 +++++-- assets/images/bellSlash.svg | 7 +++++-- src/libs/actions/Report.js | 4 ++-- .../report/ContextMenu/ContextMenuActions.js | 20 ++++++++----------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/assets/images/bell.svg b/assets/images/bell.svg index a53c9508cbd6..6ba600dc695b 100644 --- a/assets/images/bell.svg +++ b/assets/images/bell.svg @@ -1,3 +1,6 @@ - - + + + + diff --git a/assets/images/bellSlash.svg b/assets/images/bellSlash.svg index 2cacb07f4268..488acc4de05e 100644 --- a/assets/images/bellSlash.svg +++ b/assets/images/bellSlash.svg @@ -1,3 +1,6 @@ - - + + + + diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index c9ab02f127f4..d7c8be68977c 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1352,9 +1352,9 @@ function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = if (childReportID !== '0') { openReport(childReportID); if (!prevNotificationPreference || prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { - updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false) + updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false); } else { - updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, false) + updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, false); } } else { const participantAccountIDs = _.uniq([currentUserAccountID, Number(parentReportAction.actorAccountID)]); diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 468c06326064..ba5c274ed59a 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -22,10 +22,6 @@ import MiniQuickEmojiReactions from '../../../../components/Reactions/MiniQuickE import Navigation from '../../../../libs/Navigation/Navigation'; import ROUTES from '../../../../ROUTES'; import * as Task from '../../../../libs/actions/Task'; -import * as Localize from '../../../../libs/Localize'; -import * as TransactionUtils from '../../../../libs/TransactionUtils'; -import * as CurrencyUtils from '../../../../libs/CurrencyUtils'; -import Log from '../../../../libs/Log'; /** * Gets the HTML version of the message in an action. @@ -156,7 +152,7 @@ export default [ successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); - const subscribed = childReportNotificationPreference && (childReportNotificationPreference !== "hidden"); + const subscribed = childReportNotificationPreference && childReportNotificationPreference !== 'hidden'; if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { return false; } @@ -173,10 +169,10 @@ export default [ Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); }); return; - } else { - ReportActionComposeFocusManager.focus(); - Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); } + + ReportActionComposeFocusManager.focus(); + Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); }, getDescription: () => {}, }, @@ -189,7 +185,7 @@ export default [ successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); - const subscribed = childReportNotificationPreference && (childReportNotificationPreference !== "hidden"); + const subscribed = childReportNotificationPreference && childReportNotificationPreference !== 'hidden'; if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { return false; } @@ -206,10 +202,10 @@ export default [ Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); }); return; - } else { - ReportActionComposeFocusManager.focus(); - Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); } + + ReportActionComposeFocusManager.focus(); + Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); }, getDescription: () => {}, }, From f016bb803da86d178715ce4d8179e5b999606641 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 17 Oct 2023 03:23:22 -0400 Subject: [PATCH 07/19] prettier --- src/pages/home/report/ContextMenu/ContextMenuActions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index ba5c274ed59a..8006cd3e3f29 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -170,7 +170,7 @@ export default [ }); return; } - + ReportActionComposeFocusManager.focus(); Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); }, @@ -203,7 +203,7 @@ export default [ }); return; } - + ReportActionComposeFocusManager.focus(); Report.toggleSubscribeToChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID, childReportNotificationPreference); }, From 9beba29d8cd3fbc95723ae061aa9e99dba9ed519 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 17 Oct 2023 18:36:18 -0400 Subject: [PATCH 08/19] pass in prev notification preference --- src/libs/actions/Report.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index d7c8be68977c..96975d9b2383 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1352,9 +1352,9 @@ function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = if (childReportID !== '0') { openReport(childReportID); if (!prevNotificationPreference || prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { - updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false); + updateNotificationPreference(childReportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false); } else { - updateNotificationPreference(childReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, false); + updateNotificationPreference(childReportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, false); } } else { const participantAccountIDs = _.uniq([currentUserAccountID, Number(parentReportAction.actorAccountID)]); From 341d267aff9c5c1ec9fa86832cb2c226c6434c38 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 17 Oct 2023 21:33:38 -0400 Subject: [PATCH 09/19] update notification preferences optimistically --- src/libs/actions/Report.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 96975d9b2383..223ee41a5991 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1311,8 +1311,10 @@ function saveReportActionDraftNumberOfLines(reportID, reportActionID, numberOfLi * @param {String} previousValue * @param {String} newValue * @param {boolean} navigate + * @param {String} parentReportID + * @param {String} parentReportActionID */ -function updateNotificationPreference(reportID, previousValue, newValue, navigate) { +function updateNotificationPreference(reportID, previousValue, newValue, navigate, parentReportID = 0, parentReportActionID = 0) { if (previousValue === newValue) { if (navigate) { Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID)); @@ -1333,7 +1335,23 @@ function updateNotificationPreference(reportID, previousValue, newValue, navigat value: {notificationPreference: previousValue}, }, ]; - API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); + if (parentReportID && parentReportActionID) { + optimisticData.push( + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, + value: {[parentReportActionID] : {childReportNotificationPreference: newValue}}, + } + ); + failureData.push( + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, + value: {[parentReportActionID] : {childReportNotificationPreference: previousValue}}, + } + ) + } + API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue, parentReportID, parentReportActionID}, {optimisticData, failureData}); if (navigate) { Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID)); } @@ -1351,10 +1369,11 @@ function updateNotificationPreference(reportID, previousValue, newValue, navigat function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = {}, parentReportID = '0', prevNotificationPreference) { if (childReportID !== '0') { openReport(childReportID); + const parentReportActionID = lodashGet(parentReportAction, 'reportActionID', '0'); if (!prevNotificationPreference || prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { - updateNotificationPreference(childReportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false); + updateNotificationPreference(childReportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false, parentReportID, parentReportActionID); } else { - updateNotificationPreference(childReportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, false); + updateNotificationPreference(childReportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, false, parentReportID, parentReportActionID); } } else { const participantAccountIDs = _.uniq([currentUserAccountID, Number(parentReportAction.actorAccountID)]); From e6851b38c971df65cf722272100efcad5cfc3a7d Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 17 Oct 2023 22:30:28 -0400 Subject: [PATCH 10/19] prettier --- src/libs/actions/Report.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 223ee41a5991..8506807a0fff 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1336,20 +1336,16 @@ function updateNotificationPreference(reportID, previousValue, newValue, navigat }, ]; if (parentReportID && parentReportActionID) { - optimisticData.push( - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, - value: {[parentReportActionID] : {childReportNotificationPreference: newValue}}, - } - ); - failureData.push( - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, - value: {[parentReportActionID] : {childReportNotificationPreference: previousValue}}, - } - ) + optimisticData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, + value: {[parentReportActionID]: {childReportNotificationPreference: newValue}}, + }); + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, + value: {[parentReportActionID]: {childReportNotificationPreference: previousValue}}, + }); } API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue, parentReportID, parentReportActionID}, {optimisticData, failureData}); if (navigate) { From d30f297412c3450f1175c5e2cdf4d58f50fcac60 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 17 Oct 2023 22:42:38 -0400 Subject: [PATCH 11/19] update notification preference on new reports --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 8506807a0fff..6dd66d570450 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1391,7 +1391,7 @@ function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = const participantLogins = PersonalDetailsUtils.getLoginsByAccountIDs(newChat.participantAccountIDs); openReport(newChat.reportID, participantLogins, newChat, parentReportAction.reportActionID); - Navigation.navigate(ROUTES.getReportRoute(newChat.reportID)); + updateNotificationPreference(newChat.reportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false, parentReportID, parentReportAction.reportActionID); } } From 28105ea2ca5838ee6cb9230b836f7fa58636600e Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 19 Oct 2023 03:55:34 -0400 Subject: [PATCH 12/19] restore ios folder from main --- ios/NewExpensify.xcodeproj/project.pbxproj | 18 ++---------------- ios/NewExpensify/Info.plist | 4 ++-- ios/NewExpensifyTests/Info.plist | 4 ++-- ios/Podfile.lock | 14 +++++++------- ios/tmp.xcconfig | 10 +--------- 5 files changed, 14 insertions(+), 36 deletions(-) diff --git a/ios/NewExpensify.xcodeproj/project.pbxproj b/ios/NewExpensify.xcodeproj/project.pbxproj index d1cd2d066833..64ed3fda8b02 100644 --- a/ios/NewExpensify.xcodeproj/project.pbxproj +++ b/ios/NewExpensify.xcodeproj/project.pbxproj @@ -29,7 +29,7 @@ 70CF6E82262E297300711ADC /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 70CF6E81262E297300711ADC /* BootSplash.storyboard */; }; BDB853621F354EBB84E619C2 /* ExpensifyNewKansas-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = D2AFB39EC1D44BF9B91D3227 /* ExpensifyNewKansas-MediumItalic.otf */; }; DD79042B2792E76D004484B4 /* RCTBootSplash.m in Sources */ = {isa = PBXBuildFile; fileRef = DD79042A2792E76D004484B4 /* RCTBootSplash.m */; }; - E51DC681C7DEE40AEBDDFBFE /* (null) in Frameworks */ = {isa = PBXBuildFile; }; + E51DC681C7DEE40AEBDDFBFE /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; E9DF872D2525201700607FDC /* AirshipConfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = E9DF872C2525201700607FDC /* AirshipConfig.plist */; }; ED222ED90E074A5481A854FA /* ExpensifyNeue-BoldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 8B28D84EF339436DBD42A203 /* ExpensifyNeue-BoldItalic.otf */; }; F0C450EA2705020500FD2970 /* colors.json in Resources */ = {isa = PBXBuildFile; fileRef = F0C450E92705020500FD2970 /* colors.json */; }; @@ -124,7 +124,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E51DC681C7DEE40AEBDDFBFE /* (null) in Frameworks */, + E51DC681C7DEE40AEBDDFBFE /* BuildFile in Frameworks */, 5A464BC8112CDB1DE1E38F1C /* libPods-NewExpensify.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -722,11 +722,9 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = NewExpensify/Chat.entitlements; CODE_SIGN_IDENTITY = "iPhone Distribution"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; ENABLE_BITCODE = NO; INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -740,7 +738,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.dev; PRODUCT_NAME = "New Expensify Dev"; PROVISIONING_PROFILE_SPECIFIER = expensify_chat_dev; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_dev; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -757,11 +754,9 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = NewExpensify/Chat.entitlements; CODE_SIGN_IDENTITY = "iPhone Distribution"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; INFOPLIST_FILE = NewExpensify/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -774,7 +769,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.dev; PRODUCT_NAME = "New Expensify Dev"; PROVISIONING_PROFILE_SPECIFIER = expensify_chat_dev; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_dev; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; @@ -982,7 +976,6 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; ENABLE_BITCODE = NO; INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -996,7 +989,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.chat.expensify.chat; PRODUCT_NAME = "New Expensify"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = chat_expensify_appstore; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1106,7 +1098,6 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; ENABLE_BITCODE = NO; INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1120,7 +1111,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.adhoc; PRODUCT_NAME = "New Expensify AdHoc"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_adhoc; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1224,7 +1214,6 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; INFOPLIST_FILE = NewExpensify/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1237,7 +1226,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.chat.expensify.chat; PRODUCT_NAME = "New Expensify"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = chat_expensify_appstore; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; @@ -1338,7 +1326,6 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 368M544MTT; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT; INFOPLIST_FILE = NewExpensify/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1351,7 +1338,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.expensify.chat.adhoc; PRODUCT_NAME = "New Expensify AdHoc"; PROVISIONING_PROFILE_SPECIFIER = chat_expensify_appstore; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = expensify_chat_adhoc; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index cb04e9c1ef90..8eed7d03e73f 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.3.81 + 1.3.87 CFBundleSignature ???? CFBundleURLTypes @@ -40,7 +40,7 @@ CFBundleVersion - 1.3.81.10 + 1.3.87.1 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index e597c10142d8..57b623864549 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.3.81 + 1.3.87 CFBundleSignature ???? CFBundleVersion - 1.3.81.10 + 1.3.87.1 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 54d0525fd3c9..cb120bca2b88 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -251,9 +251,9 @@ PODS: - nanopb/encode (= 2.30908.0) - nanopb/decode (2.30908.0) - nanopb/encode (2.30908.0) - - Onfido (27.4.0) - - onfido-react-native-sdk (7.4.0): - - Onfido (= 27.4.0) + - Onfido (28.3.0) + - onfido-react-native-sdk (8.3.0): + - Onfido (~> 28.3.0) - React - OpenSSL-Universal (1.1.1100) - Plaid (4.1.0) @@ -819,7 +819,7 @@ PODS: - SDWebImage/Core (~> 5.10) - SocketRocket (0.6.1) - Turf (2.6.1) - - VisionCamera (2.15.4): + - VisionCamera (2.16.2): - React - React-callinvoker - React-Core @@ -1204,8 +1204,8 @@ SPEC CHECKSUMS: MapboxMaps: af50ec61a7eb3b032c3f7962c6bd671d93d2a209 MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6 nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 - Onfido: e36f284b865adcf99d9c905590a64ac09d4a576b - onfido-react-native-sdk: 4ecde1a97435dcff9f00a878e3f8d1eb14fabbdc + Onfido: c7d010d9793790d44a07799d9be25aa8e3814ee7 + onfido-react-native-sdk: b346a620af5669f9fecb6dc3052314a35a94ad9f OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c Plaid: 7d340abeadb46c7aa1a91f896c5b22395a31fcf2 PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef @@ -1287,7 +1287,7 @@ SPEC CHECKSUMS: SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 469ce2c3d22e5e8e4818d5a3b254699a5c89efa4 - VisionCamera: d3ec8883417a6a4a0e3a6ba37d81d22db7611601 + VisionCamera: 95f969b8950b411285579d633a1014782fe0e634 Yoga: 3efc43e0d48686ce2e8c60f99d4e6bd349aff981 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/ios/tmp.xcconfig b/ios/tmp.xcconfig index 2f2502669450..8b137891791f 100644 --- a/ios/tmp.xcconfig +++ b/ios/tmp.xcconfig @@ -1,9 +1 @@ -NEW_EXPENSIFY_URL=https:/$()/new.expensify.com/ -SECURE_EXPENSIFY_URL=https:/$()/secure.expensify.com/ -EXPENSIFY_URL=https:/$()/www.expensify.com/ -EXPENSIFY_PARTNER_NAME=chat-expensify-com -EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66 -PUSHER_APP_KEY=268df511a204fbb60884 -USE_WEB_PROXY=false -ENVIRONMENT=production -SEND_CRASH_REPORTS=true + From c7a0c606782349385f45fee20cf463b28141787a Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 19 Oct 2023 04:06:21 -0400 Subject: [PATCH 13/19] cleanup changes --- src/languages/es.ts | 120 +++++++++--------- .../report/ContextMenu/ContextMenuActions.js | 4 +- 2 files changed, 61 insertions(+), 63 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 5b03ff63438d..1e3ea723288c 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2,81 +2,81 @@ import CONST from '../CONST'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; import type { AddressLineParams, - CharacterLimitParams, - MaxParticipantsReachedParams, - ZipCodeExampleFormatParams, - LoggedInAsParams, - NewFaceEnterMagicCodeParams, - WelcomeEnterMagicCodeParams, AlreadySignedInParams, - GoBackMessageParams, - LocalTimeParams, - EditActionParams, - DeleteActionParams, - DeleteConfirmationParams, - BeginningOfChatHistoryDomainRoomPartOneParams, + AmountEachParams, BeginningOfChatHistoryAdminRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartTwo, - WelcomeToRoomParams, - ReportArchiveReasonsClosedParams, - ReportArchiveReasonsMergedParams, - ReportArchiveReasonsRemovedFromPolicyParams, - ReportArchiveReasonsPolicyDeletedParams, - RequestCountParams, - SettleExpensifyCardParams, - RequestAmountParams, - SplitAmountParams, + BeginningOfChatHistoryDomainRoomPartOneParams, + CharacterLimitParams, + ConfirmThatParams, + DateShouldBeAfterParams, + DateShouldBeBeforeParams, + DeleteActionParams, + DeleteConfirmationParams, DidSplitAmountMessageParams, - AmountEachParams, + EditActionParams, + EnglishTranslation, + EnterMagicCodeParams, + FormattedMaxLengthParams, + GoBackMessageParams, + GoToRoomParams, + IncorrectZipFormatParams, + InstantSummaryParams, + LocalTimeParams, + LoggedInAsParams, + ManagerApprovedParams, + MaxParticipantsReachedParams, + NewFaceEnterMagicCodeParams, + NoLongerHaveAccessParams, + NotAllowedExtensionParams, + NotYouParams, + OOOEventSummaryFullDayParams, + OOOEventSummaryPartialDayParams, + OurEmailProviderParams, + PaidElsewhereWithAmountParams, + PaidWithExpensifyWithAmountParams, + ParentNavigationSummaryParams, PayerOwesAmountParams, PayerOwesParams, PayerPaidAmountParams, PayerPaidParams, PayerSettledParams, - WaitingOnBankAccountParams, + RemovedTheRequestParams, + RenamedRoomActionParams, + ReportArchiveReasonsClosedParams, + ReportArchiveReasonsMergedParams, + ReportArchiveReasonsPolicyDeletedParams, + ReportArchiveReasonsRemovedFromPolicyParams, + RequestAmountParams, + RequestCountParams, + RequestedAmountMessageParams, + ResolutionConstraintsParams, + RoomNameReservedErrorParams, + RoomRenamedToParams, + SetTheDistanceParams, + SetTheRequestParams, + SettleExpensifyCardParams, SettledAfterAddedBankAccountParams, - PaidElsewhereWithAmountParams, - PaidWithExpensifyWithAmountParams, + SizeExceededParams, + SplitAmountParams, + StepCounterParams, + TagSelectionParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, - SizeExceededParams, - ResolutionConstraintsParams, - NotAllowedExtensionParams, - EnterMagicCodeParams, - TransferParams, - InstantSummaryParams, - NotYouParams, - DateShouldBeBeforeParams, - DateShouldBeAfterParams, - IncorrectZipFormatParams, - WeSentYouMagicSignInLinkParams, ToValidateLoginParams, - NoLongerHaveAccessParams, - OurEmailProviderParams, - ConfirmThatParams, + TransferParams, UntilTimeParams, - StepCounterParams, - UserIsAlreadyMemberParams, - GoToRoomParams, - WelcomeNoteParams, - RoomNameReservedErrorParams, - RenamedRoomActionParams, - RoomRenamedToParams, - OOOEventSummaryFullDayParams, - OOOEventSummaryPartialDayParams, - ParentNavigationSummaryParams, - ManagerApprovedParams, - SetTheRequestParams, - SetTheDistanceParams, - UpdatedTheRequestParams, UpdatedTheDistanceParams, - RemovedTheRequestParams, - FormattedMaxLengthParams, - RequestedAmountMessageParams, - TagSelectionParams, - EnglishTranslation, + UpdatedTheRequestParams, + UserIsAlreadyMemberParams, + WaitingOnBankAccountParams, WalletProgramParams, + WeSentYouMagicSignInLinkParams, + WelcomeEnterMagicCodeParams, + WelcomeNoteParams, + WelcomeToRoomParams, + ZipCodeExampleFormatParams, } from './types'; /* eslint-disable max-len */ @@ -417,8 +417,8 @@ export default { deleteConfirmation: ({action}: DeleteConfirmationParams) => `¿Estás seguro de que quieres eliminar este ${ReportActionsUtils.isMoneyRequestAction(action) ? 'pedido' : 'comentario'}`, onlyVisible: 'Visible sólo para', replyInThread: 'Responder en el hilo', - subscribeToThread: 'NEED TO TRANSLATE', - unsubscribeFromThread: 'NEED TO TRANSLATE', + subscribeToThread: 'Suscríbete al hilo', + unsubscribeFromThread: 'Darse de baja del hilo', flagAsOffensive: 'Marcar como ofensivo', }, emojiReactions: { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 8006cd3e3f29..999f8e9fa26b 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -134,7 +134,7 @@ export default [ if (closePopover) { hideContextMenu(false, () => { ReportActionComposeFocusManager.focus(); - Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', ''), reportAction, reportID); + Report.navigateToAndOpenChildReport(lodashGet(reportAction, 'childReportID', '0'), reportAction, reportID); }); return; } @@ -146,7 +146,6 @@ export default [ { isAnonymousAction: false, textTranslateKey: 'reportActionContextMenu.subscribeToThread', - // textTranslateKey: lodashGet(reportAction, 'childReportNotificationPreference', '0'), icon: Expensicons.Bell, successTextTranslateKey: '', successIcon: null, @@ -179,7 +178,6 @@ export default [ { isAnonymousAction: false, textTranslateKey: 'reportActionContextMenu.unsubscribeFromThread', - // textTranslateKey: lodashGet(reportAction, 'childReportNotificationPreference', '0'), icon: Expensicons.BellSlash, successTextTranslateKey: '', successIcon: null, From 8a609fd5b22dd83baf79b48f65e481d02ac25598 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 19 Oct 2023 04:07:45 -0400 Subject: [PATCH 14/19] revert accidental change --- src/languages/es.ts | 116 ++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 1e3ea723288c..0ecff93d2758 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2,81 +2,81 @@ import CONST from '../CONST'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; import type { AddressLineParams, + CharacterLimitParams, + MaxParticipantsReachedParams, + ZipCodeExampleFormatParams, + LoggedInAsParams, + NewFaceEnterMagicCodeParams, + WelcomeEnterMagicCodeParams, AlreadySignedInParams, - AmountEachParams, + GoBackMessageParams, + LocalTimeParams, + EditActionParams, + DeleteActionParams, + DeleteConfirmationParams, + BeginningOfChatHistoryDomainRoomPartOneParams, BeginningOfChatHistoryAdminRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartTwo, - BeginningOfChatHistoryDomainRoomPartOneParams, - CharacterLimitParams, - ConfirmThatParams, - DateShouldBeAfterParams, - DateShouldBeBeforeParams, - DeleteActionParams, - DeleteConfirmationParams, + WelcomeToRoomParams, + ReportArchiveReasonsClosedParams, + ReportArchiveReasonsMergedParams, + ReportArchiveReasonsRemovedFromPolicyParams, + ReportArchiveReasonsPolicyDeletedParams, + RequestCountParams, + SettleExpensifyCardParams, + RequestAmountParams, + SplitAmountParams, DidSplitAmountMessageParams, - EditActionParams, - EnglishTranslation, - EnterMagicCodeParams, - FormattedMaxLengthParams, - GoBackMessageParams, - GoToRoomParams, - IncorrectZipFormatParams, - InstantSummaryParams, - LocalTimeParams, - LoggedInAsParams, - ManagerApprovedParams, - MaxParticipantsReachedParams, - NewFaceEnterMagicCodeParams, - NoLongerHaveAccessParams, - NotAllowedExtensionParams, - NotYouParams, - OOOEventSummaryFullDayParams, - OOOEventSummaryPartialDayParams, - OurEmailProviderParams, - PaidElsewhereWithAmountParams, - PaidWithExpensifyWithAmountParams, - ParentNavigationSummaryParams, + AmountEachParams, PayerOwesAmountParams, PayerOwesParams, PayerPaidAmountParams, PayerPaidParams, PayerSettledParams, - RemovedTheRequestParams, - RenamedRoomActionParams, - ReportArchiveReasonsClosedParams, - ReportArchiveReasonsMergedParams, - ReportArchiveReasonsPolicyDeletedParams, - ReportArchiveReasonsRemovedFromPolicyParams, - RequestAmountParams, - RequestCountParams, - RequestedAmountMessageParams, - ResolutionConstraintsParams, - RoomNameReservedErrorParams, - RoomRenamedToParams, - SetTheDistanceParams, - SetTheRequestParams, - SettleExpensifyCardParams, + WaitingOnBankAccountParams, SettledAfterAddedBankAccountParams, - SizeExceededParams, - SplitAmountParams, - StepCounterParams, - TagSelectionParams, + PaidElsewhereWithAmountParams, + PaidWithExpensifyWithAmountParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, - ToValidateLoginParams, + SizeExceededParams, + ResolutionConstraintsParams, + NotAllowedExtensionParams, + EnterMagicCodeParams, TransferParams, + InstantSummaryParams, + NotYouParams, + DateShouldBeBeforeParams, + DateShouldBeAfterParams, + IncorrectZipFormatParams, + WeSentYouMagicSignInLinkParams, + ToValidateLoginParams, + NoLongerHaveAccessParams, + OurEmailProviderParams, + ConfirmThatParams, UntilTimeParams, - UpdatedTheDistanceParams, - UpdatedTheRequestParams, + StepCounterParams, UserIsAlreadyMemberParams, - WaitingOnBankAccountParams, - WalletProgramParams, - WeSentYouMagicSignInLinkParams, - WelcomeEnterMagicCodeParams, + GoToRoomParams, WelcomeNoteParams, - WelcomeToRoomParams, - ZipCodeExampleFormatParams, + RoomNameReservedErrorParams, + RenamedRoomActionParams, + RoomRenamedToParams, + OOOEventSummaryFullDayParams, + OOOEventSummaryPartialDayParams, + ParentNavigationSummaryParams, + ManagerApprovedParams, + SetTheRequestParams, + SetTheDistanceParams, + UpdatedTheRequestParams, + UpdatedTheDistanceParams, + RemovedTheRequestParams, + FormattedMaxLengthParams, + RequestedAmountMessageParams, + TagSelectionParams, + EnglishTranslation, + WalletProgramParams, } from './types'; /* eslint-disable max-len */ From db19896eff8e7589909a1b7b3cd9955c3cc77eb5 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 19 Oct 2023 18:57:10 -0400 Subject: [PATCH 15/19] remove extra parameters --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 7d8bce044f94..cdc07df2ea13 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1354,7 +1354,7 @@ function updateNotificationPreference(reportID, previousValue, newValue, navigat value: {[parentReportActionID]: {childReportNotificationPreference: previousValue}}, }); } - API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue, parentReportID, parentReportActionID}, {optimisticData, failureData}); + API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); if (navigate) { Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID)); } From 986529036ba06832f10ae7f3dc387872e6519ea5 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 19 Oct 2023 18:58:34 -0400 Subject: [PATCH 16/19] modify spanish translation --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 0ecff93d2758..287790fe24c7 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -417,7 +417,7 @@ export default { deleteConfirmation: ({action}: DeleteConfirmationParams) => `¿Estás seguro de que quieres eliminar este ${ReportActionsUtils.isMoneyRequestAction(action) ? 'pedido' : 'comentario'}`, onlyVisible: 'Visible sólo para', replyInThread: 'Responder en el hilo', - subscribeToThread: 'Suscríbete al hilo', + subscribeToThread: 'Suscribirse al hilo', unsubscribeFromThread: 'Darse de baja del hilo', flagAsOffensive: 'Marcar como ofensivo', }, From e93d6dde643a722b4765589fbe3a8181ea76216e Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Fri, 20 Oct 2023 19:22:58 -0400 Subject: [PATCH 17/19] unsubscribe on new comment --- src/libs/ReportUtils.js | 11 +++++++++++ src/libs/actions/Report.js | 3 ++- .../report/ContextMenu/ContextMenuActions.js | 17 +++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index efd4557aea8b..8ea5c20b324f 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -777,6 +777,16 @@ function getReport(reportID) { return lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {}) || {}; } +/** + * Returns whether or not the author of the action is this user + * + * @param {Object} reportAction + * @returns {Boolean} + */ +function isActionCreator(reportAction) { + return reportAction.actorAccountID === currentUserAccountID +} + /** * Can only delete if the author is this user and the action is an ADDCOMMENT action or an IOU action in an unsettled report, or if the user is a * policy admin @@ -3969,6 +3979,7 @@ export { canEditReportAction, canFlagReportAction, shouldShowFlagComment, + isActionCreator, canDeleteReportAction, canLeaveRoom, sortReportsByLastRead, diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 93b2d72f9d96..2e714154c8aa 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1398,7 +1398,8 @@ function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = const participantLogins = PersonalDetailsUtils.getLoginsByAccountIDs(newChat.participantAccountIDs); openReport(newChat.reportID, participantLogins, newChat, parentReportAction.reportActionID); - updateNotificationPreference(newChat.reportID, prevNotificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false, parentReportID, parentReportAction.reportActionID); + const notificationPreference = prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; + updateNotificationPreference(newChat.reportID, prevNotificationPreference, notificationPreference, false, parentReportID, parentReportAction.reportActionID); } } diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 999f8e9fa26b..cb26af15181d 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -150,11 +150,12 @@ export default [ successTextTranslateKey: '', successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { - const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); - const subscribed = childReportNotificationPreference && childReportNotificationPreference !== 'hidden'; - if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { - return false; + 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; const isIOUAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && !ReportActionsUtils.isSplitBillAction(reportAction); @@ -182,8 +183,12 @@ export default [ successTextTranslateKey: '', successIcon: null, shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { - const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); - const subscribed = childReportNotificationPreference && childReportNotificationPreference !== 'hidden'; + 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; } From 6caf051a8d0e1fb734c6fd1887f36afba9fe7fd6 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Fri, 20 Oct 2023 19:54:04 -0400 Subject: [PATCH 18/19] prettier --- src/libs/ReportUtils.js | 2 +- src/libs/actions/Report.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 8ea5c20b324f..7f231381c85d 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -784,7 +784,7 @@ function getReport(reportID) { * @returns {Boolean} */ function isActionCreator(reportAction) { - return reportAction.actorAccountID === currentUserAccountID + return reportAction.actorAccountID === currentUserAccountID; } /** diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 2e714154c8aa..38889a474231 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1398,7 +1398,8 @@ function toggleSubscribeToChildReport(childReportID = '0', parentReportAction = const participantLogins = PersonalDetailsUtils.getLoginsByAccountIDs(newChat.participantAccountIDs); openReport(newChat.reportID, participantLogins, newChat, parentReportAction.reportActionID); - const notificationPreference = prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; + const notificationPreference = + prevNotificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; updateNotificationPreference(newChat.reportID, prevNotificationPreference, notificationPreference, false, parentReportID, parentReportAction.reportActionID); } } From c4182b36cb17a87789777f2296ae48f45040ec25 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Fri, 20 Oct 2023 20:52:20 -0400 Subject: [PATCH 19/19] change subscribe based on user created --- .../home/report/ContextMenu/ContextMenuActions.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index cb26af15181d..c4fac6d21283 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -162,7 +162,11 @@ export default [ return !subscribed && (isCommentAction || isReportPreviewAction || isIOUAction); }, onPress: (closePopover, {reportAction, reportID}) => { - const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); + 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(); @@ -198,7 +202,11 @@ export default [ return subscribed && (isCommentAction || isReportPreviewAction || isIOUAction); }, onPress: (closePopover, {reportAction, reportID}) => { - const childReportNotificationPreference = lodashGet(reportAction, 'childReportNotificationPreference', ''); + 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();