Merge pull request #1821 from Brice-W/bug-fixes

Bug fixes
This commit is contained in:
Audric Ackermann 2021-08-02 21:50:38 -07:00 committed by GitHub
commit f7658c323d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 3 deletions

View File

@ -101,7 +101,7 @@ export const MessageContextMenu = (props: PropsForMessageContextMenu) => {
const saveAttachment = useCallback(
(e: any) => {
e.stopPropagation();
e.event.stopPropagation();
if (!attachments?.length) {
return;
}

View File

@ -825,7 +825,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
_.defaults(options, { fromSync: false });
if (!expireTimer) {
expireTimer = null;
expireTimer = 0;
}
if (this.get('expireTimer') === expireTimer || (!expireTimer && !this.get('expireTimer'))) {
return null;
@ -852,6 +852,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
// indicator above it. We set it to 'unread' to trigger that placement.
unread: isOutgoing ? 0 : 1,
conversationId: this.id,
source,
// No type; 'incoming' messages are specially treated by conversation.markRead()
sent_at: timestamp,
received_at: timestamp,

View File

@ -513,6 +513,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
// isSelected: this.isSelected,
id: this.id as string,
conversationId: this.get('conversationId'),
source: this.get('source'),
receivedAt: this.get('received_at'),
snippet: this.get('snippet'),
};

View File

@ -115,7 +115,7 @@ export type PropsForDataExtractionNotification = DataExtractionNotificationMsg &
export interface MessageAttributesOptionals {
id?: string;
source?: string;
source: string;
quote?: any;
expireTimer?: number;
received_at?: number;

View File

@ -515,6 +515,7 @@ export async function handleDataExtractionNotification(
await convo.addSingleMessage({
conversationId: convo.get('id'),
source,
type: 'outgoing', // mark it as outgoing just so it appears below our sent attachment
sent_at: envelopeTimestamp,
received_at: now,

View File

@ -164,8 +164,11 @@ export async function addUpdateMessage(
const unread = type === 'incoming';
const source = UserUtils.getOurPubKeyStrFromCache();
const message = await convo.addSingleMessage({
conversationId: convo.get('id'),
source,
type,
sent_at: sentAt,
received_at: now,
@ -313,9 +316,12 @@ export async function leaveClosedGroup(groupId: string) {
convo.set({ groupAdmins: admins });
await convo.commit();
const source = UserUtils.getOurPubKeyStrFromCache();
const dbMessage = await convo.addSingleMessage({
group_update: { left: 'You' },
conversationId: groupId,
source,
type: 'outgoing',
sent_at: now,
received_at: now,

View File

@ -128,6 +128,7 @@ export type PropsForSearchResults = {
to: FindAndFormatContactType;
id: string;
conversationId: string;
source: string;
receivedAt: number | undefined;
snippet?: string; //not sure about the type of snippet
};