Make block/report keep chat timestamp
This commit is contained in:
parent
89ebbf8af4
commit
85414e1c95
5 changed files with 43 additions and 5 deletions
|
@ -2654,6 +2654,10 @@
|
|||
"messageformat": "Message Request",
|
||||
"description": "Preview shown for conversation if the user has not yet accepted an incoming message request"
|
||||
},
|
||||
"icu:ConversationListItem--blocked": {
|
||||
"messageformat": "Blocked",
|
||||
"description": "Preview shown for conversation that has been blocked"
|
||||
},
|
||||
"icu:ConversationListItem--draft-prefix": {
|
||||
"messageformat": "Draft:",
|
||||
"description": "Prefix shown in italic in conversation view when a draft is saved"
|
||||
|
|
|
@ -4948,6 +4948,22 @@ button.module-image__border-overlay:focus {
|
|||
height: 36px; // two lines
|
||||
}
|
||||
|
||||
&__blocked {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-inline-end: 4px;
|
||||
@include color-svg(
|
||||
'../images/icons/v3/block/block.svg',
|
||||
currentColor
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
&__message-request {
|
||||
@include font-body-2-bold;
|
||||
|
||||
|
|
|
@ -377,6 +377,7 @@ export function ConversationList({
|
|||
'draftPreview',
|
||||
'groupId',
|
||||
'id',
|
||||
'isBlocked',
|
||||
'isMe',
|
||||
'isSelected',
|
||||
'isPinned',
|
||||
|
|
|
@ -45,6 +45,7 @@ export type PropsData = Pick<
|
|||
| 'draftPreview'
|
||||
| 'groupId'
|
||||
| 'id'
|
||||
| 'isBlocked'
|
||||
| 'isMe'
|
||||
// NOTE: Passed for CI, not used for rendering
|
||||
| 'isPinned'
|
||||
|
@ -89,6 +90,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
|
|||
groupId,
|
||||
i18n,
|
||||
id,
|
||||
isBlocked,
|
||||
isMe,
|
||||
isSelected,
|
||||
lastMessage,
|
||||
|
@ -135,7 +137,13 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
|
|||
let messageText: ReactNode = null;
|
||||
let messageStatusIcon: ReactNode = null;
|
||||
|
||||
if (!acceptedMessageRequest && removalStage !== 'justNotification') {
|
||||
if (isBlocked) {
|
||||
messageText = (
|
||||
<span className={`${MESSAGE_TEXT_CLASS_NAME}__blocked`}>
|
||||
{i18n('icu:ConversationListItem--blocked')}
|
||||
</span>
|
||||
);
|
||||
} else if (!acceptedMessageRequest && removalStage !== 'justNotification') {
|
||||
messageText = (
|
||||
<span className={`${MESSAGE_TEXT_CLASS_NAME}__message-request`}>
|
||||
{i18n('icu:ConversationListItem--message-request')}
|
||||
|
|
|
@ -2122,17 +2122,26 @@ export class ConversationModel extends window.Backbone
|
|||
async addMessageRequestResponseEventMessage(
|
||||
event: MessageRequestResponseEvent
|
||||
): Promise<void> {
|
||||
const now = Date.now();
|
||||
const timestamp = Date.now();
|
||||
const lastMessageTimestamp =
|
||||
// Fallback to `timestamp` since `lastMessageReceivedAtMs` is new
|
||||
this.get('lastMessageReceivedAtMs') ?? this.get('timestamp') ?? timestamp;
|
||||
|
||||
const maybeLastMessageTimestamp =
|
||||
event === MessageRequestResponseEvent.ACCEPT
|
||||
? timestamp
|
||||
: lastMessageTimestamp;
|
||||
|
||||
const message: MessageAttributesType = {
|
||||
id: generateGuid(),
|
||||
conversationId: this.id,
|
||||
type: 'message-request-response-event',
|
||||
sent_at: now,
|
||||
sent_at: maybeLastMessageTimestamp,
|
||||
received_at: incrementMessageCounter(),
|
||||
received_at_ms: now,
|
||||
received_at_ms: maybeLastMessageTimestamp,
|
||||
readStatus: ReadStatus.Read,
|
||||
seenStatus: SeenStatus.NotApplicable,
|
||||
timestamp: now,
|
||||
timestamp,
|
||||
messageRequestResponseEvent: event,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue