change source of MessageAttributesOptionals to not null

This commit is contained in:
Brice-W 2021-08-03 14:31:06 +10:00
parent 4ba0154e06
commit f7c7d6a3d8
6 changed files with 11 additions and 1 deletions

View File

@ -852,6 +852,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
// indicator above it. We set it to 'unread' to trigger that placement.
unread: 1,
conversationId: this.id,
source,
// No type; 'incoming' messages are specially treated by conversation.markRead()
sent_at: timestamp,
received_at: timestamp,

View File

@ -506,6 +506,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

@ -117,7 +117,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

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