-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix copy invite room message #30898
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
Fix copy invite room message #30898
Changes from 1 commit
9fbb883
c1ddbef
427be61
4df098e
db16de3
65c5cc9
d581ca2
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ import ROUTES from '@src/ROUTES'; | |
import * as CurrencyUtils from './CurrencyUtils'; | ||
import DateUtils from './DateUtils'; | ||
import isReportMessageAttachment from './isReportMessageAttachment'; | ||
import * as LocalePhoneNumber from './LocalePhoneNumber'; | ||
import * as Localize from './Localize'; | ||
import linkingConfig from './Navigation/linkingConfig'; | ||
import Navigation from './Navigation/Navigation'; | ||
|
@@ -4043,6 +4044,21 @@ function getTaskAssigneeChatOnyxData(accountID, assigneeAccountID, taskReportID, | |
}; | ||
} | ||
|
||
/** | ||
* Return the mention message of a list accounntID | ||
* @param {Array<String>} accountIDs | ||
* @returns {String} | ||
*/ | ||
function getMentionMessage(accountIDs) { | ||
const listMention = _.map(accountIDs, (accountID) => { | ||
const personalDetail = lodashGet(allPersonalDetails, accountID); | ||
const displayNameOrLogin = | ||
LocalePhoneNumber.formatPhoneNumber(lodashGet(personalDetail, 'login', '')) || lodashGet(personalDetail, 'displayName', '') || Localize.translateLocal('common.hidden'); | ||
return `@${displayNameOrLogin}`; | ||
}); | ||
return listMention.join(' and '); | ||
dukenv0307 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
/** | ||
* Returns an array of the participants Ids of a report | ||
* | ||
|
@@ -4114,6 +4130,16 @@ function getIOUReportActionDisplayMessage(reportAction) { | |
return displayMessage; | ||
} | ||
|
||
/** | ||
* Return room channel log display message | ||
* @param {Object} reportAction | ||
* @returns {String} | ||
*/ | ||
function getRoomChannelLogMemberMessage(reportAction) { | ||
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. Looks better! But I have a suggestion to increase the simplicity of the function. Let me know if you agree. /**
* Return room channel log display message
*
* @param {Object} reportAction
* @returns {String}
*/
function getRoomChannelLogMemberMessage(reportAction) {
const actionPerformed = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM ? 'invited' : 'removed';
const mentions = _.map(reportAction.originalMessage.targetAccountIDs, (accountID) => {
const personalDetail = lodashGet(allPersonalDetails, accountID);
const displayNameOrLogin =
LocalePhoneNumber.formatPhoneNumber(lodashGet(personalDetail, 'login', '')) || lodashGet(personalDetail, 'displayName', '') || Localize.translateLocal('common.hidden');
return `@${displayNameOrLogin}`;
});
const lastMention = mentions.pop();
if (mentions.length === 0) {
return `${actionPerformed} ${lastMention}`;
}
return `${actionPerformed} ${mentions.join(', ')} and ${lastMention}`;
} 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. Look good to me. Will update soon. 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. @cubuspl42 I updated. |
||
const title = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM ? 'invited' : 'removed'; | ||
dukenv0307 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return `${title} ${getMentionMessage(reportAction.originalMessage.targetAccountIDs)}`; | ||
} | ||
|
||
/** | ||
* Checks if a report is a group chat. | ||
* | ||
|
@@ -4315,4 +4341,5 @@ export { | |
parseReportRouteParams, | ||
getReimbursementQueuedActionMessage, | ||
getPersonalDetailsForAccountID, | ||
getRoomChannelLogMemberMessage, | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.