-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: Translation for system message #21780
Changes from all commits
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 |
---|---|---|
|
@@ -249,6 +249,7 @@ function addActions(reportID, text = '', file) { | |
|
||
const optimisticReport = { | ||
lastVisibleActionCreated: currentTime, | ||
lastMessageTranslationKey: lodashGet(lastAction, 'message[0].translationKey', ''), | ||
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. Hi all, this PR caused a regression Red dot and [Attachment] shows in LHN even after close error message This is because we didn't set failure data for |
||
lastMessageText: lastCommentText, | ||
lastMessageHtml: lastCommentText, | ||
lastActorEmail: currentUserEmail, | ||
|
@@ -835,6 +836,7 @@ function deleteReportComment(reportID, reportAction) { | |
const reportActionID = reportAction.reportActionID; | ||
const deletedMessage = [ | ||
{ | ||
translationKey: '', | ||
type: 'COMMENT', | ||
html: '', | ||
text: '', | ||
|
@@ -854,13 +856,15 @@ function deleteReportComment(reportID, reportAction) { | |
// If we are deleting the last visible message, let's find the previous visible one (or set an empty one if there are none) and update the lastMessageText in the LHN. | ||
// Similarly, if we are deleting the last read comment we will want to update the lastVisibleActionCreated to use the previous visible message. | ||
let optimisticReport = { | ||
lastMessageTranslationKey: '', | ||
lastMessageText: '', | ||
lastVisibleActionCreated: '', | ||
}; | ||
const lastMessageText = ReportActionsUtils.getLastVisibleMessageText(originalReportID, optimisticReportActions); | ||
if (lastMessageText.length > 0) { | ||
const {lastMessageText = '', lastMessageTranslationKey = ''} = ReportActionsUtils.getLastVisibleMessage(originalReportID, optimisticReportActions); | ||
if (lastMessageText || lastMessageTranslationKey) { | ||
const lastVisibleActionCreated = ReportActionsUtils.getLastVisibleAction(originalReportID, optimisticReportActions).created; | ||
optimisticReport = { | ||
lastMessageTranslationKey, | ||
lastMessageText, | ||
lastVisibleActionCreated, | ||
}; | ||
|
@@ -1020,6 +1024,7 @@ function editReportComment(reportID, originalReportAction, textForNewComment) { | |
if (reportActionID === lastVisibleAction.reportActionID) { | ||
const lastMessageText = ReportUtils.formatReportLastMessageText(reportComment); | ||
const optimisticReport = { | ||
lastMessageTranslationKey: '', | ||
lastMessageText, | ||
}; | ||
optimisticData.push({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,14 @@ import CONST from '../CONST'; | |
* Check whether a report action is Attachment or not. | ||
* Ignore messages containing [Attachment] as the main content. Attachments are actions with only text as [Attachment]. | ||
* | ||
* @param {Object} reportActionMessage report action's message as text and html | ||
* @param {Object} reportActionMessage report action's message as text, html and translationKey | ||
* @returns {Boolean} | ||
*/ | ||
export default function isReportMessageAttachment({text, html}) { | ||
export default function isReportMessageAttachment({text, html, translationKey}) { | ||
if (translationKey) { | ||
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. 👋 This was partially responsible for a regression in #24246 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. thanks @eVoloshchak |
||
return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT; | ||
} | ||
|
||
if (!text || !html) { | ||
return false; | ||
} | ||
|
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.
It looks like that push event should also update this field to update let LHN message after sending an attachment, like this case #22937