Skip to content

Commit

Permalink
Merge pull request #16742 from Expensify/OSBotify-cherry-pick-staging…
Browse files Browse the repository at this point in the history
…-16554

🍒 Cherry pick PR #16554 to staging 🍒
  • Loading branch information
OSBotify authored Mar 30, 2023
2 parents 17f2d2b + 0328e4a commit 4c48ca2
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 9 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001029200
versionName "1.2.92-0"
versionCode 1001029201
versionName "1.2.92-1"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.92.0</string>
<string>1.2.92.1</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.92.0</string>
<string>1.2.92.1</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.2.92-0",
"version": "1.2.92-1",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
9 changes: 8 additions & 1 deletion src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,16 @@ function getOptions(reports, personalDetails, {
reportMapForLogins[logins[0]] = report;
}
const isSearchingSomeonesPolicyExpenseChat = !report.isOwnPolicyExpenseChat && searchValue !== '';

// Checks to see if the current user is the admin of the policy, if so the policy
// name preview will be shown.
const isPolicyChatAdmin = ReportUtils.isPolicyExpenseChatAdmin(report, policies);

allReportOptions.push(createOption(logins, personalDetails, report, reportActions, {
showChatPreviewLine,
forcePolicyNamePreview: isPolicyExpenseChat ? isSearchingSomeonesPolicyExpenseChat : forcePolicyNamePreview,
forcePolicyNamePreview: isPolicyExpenseChat
? (isSearchingSomeonesPolicyExpenseChat || isPolicyChatAdmin)
: forcePolicyNamePreview,
}));
});

Expand Down
20 changes: 20 additions & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,25 @@ function getPolicyName(report, policies) {
|| Localize.translateLocal('workspace.common.unavailable');
}

/**
* Checks if the current user is the admin of the policy given the policy expense chat.
* @param {Object} report
* @param {String} report.policyID
* @param {Object} policies must have OnyxKey prefix (i.e 'policy_') for keys
* @returns {Boolean}
*/
function isPolicyExpenseChatAdmin(report, policies) {
if (!isPolicyExpenseChat(report)) {
return false;
}

const policyRole = lodashGet(policies, [
`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'role',
]);

return policyRole === CONST.POLICY.ROLE.ADMIN;
}

/**
* Get either the policyName or domainName the chat is tied to
* @param {Object} report
Expand Down Expand Up @@ -1665,6 +1684,7 @@ export {
getPolicyName,
getPolicyType,
isArchivedRoom,
isPolicyExpenseChatAdmin,
isPublicRoom,
isConciergeChatReport,
hasAutomatedExpensifyEmails,
Expand Down
5 changes: 4 additions & 1 deletion src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ function getOptionData(reportID) {
}

if (result.isChatRoom || result.isPolicyExpenseChat) {
result.alternateText = lastMessageText || Localize.translate(preferredLocale, 'report.noActivityYet');
// Checks to see if the current user is the admin of the policy tied to the policy expense chat,
// if so the policy name preview will be shown.
const isPolicyChatAdmin = result.isPolicyExpenseChat && ReportUtils.isPolicyExpenseChatAdmin(report, policies);
result.alternateText = isPolicyChatAdmin ? subtitle : (lastMessageText || Localize.translate(preferredLocale, 'report.noActivityYet'));
} else {
if (!lastMessageText) {
// Here we get the beginning of chat history message and append the display name for each user, adding pronouns if there are any.
Expand Down

0 comments on commit 4c48ca2

Please sign in to comment.