Re-render left pane and timeline items when group members change
This commit is contained in:
parent
b31a44aa76
commit
7a3130a795
3 changed files with 20 additions and 30 deletions
|
@ -822,6 +822,9 @@ export class ConversationController {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
this._conversations.map(async conversation => {
|
this._conversations.map(async conversation => {
|
||||||
try {
|
try {
|
||||||
|
// Hydrate contactCollection, now that initial fetch is complete
|
||||||
|
conversation.fetchContacts();
|
||||||
|
|
||||||
const isChanged = await maybeDeriveGroupV2Id(conversation);
|
const isChanged = await maybeDeriveGroupV2Id(conversation);
|
||||||
if (isChanged) {
|
if (isChanged) {
|
||||||
updateConversation(conversation.attributes);
|
updateConversation(conversation.attributes);
|
||||||
|
|
|
@ -218,7 +218,19 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
// our first save to the database. Or first fetch from the database.
|
// our first save to the database. Or first fetch from the database.
|
||||||
this.initialPromise = Promise.resolve();
|
this.initialPromise = Promise.resolve();
|
||||||
|
|
||||||
|
this.throttledBumpTyping = window._.throttle(this.bumpTyping, 300);
|
||||||
|
this.debouncedUpdateLastMessage = window._.debounce(
|
||||||
|
this.updateLastMessage.bind(this),
|
||||||
|
200
|
||||||
|
);
|
||||||
|
|
||||||
this.contactCollection = this.getContactCollection();
|
this.contactCollection = this.getContactCollection();
|
||||||
|
this.contactCollection.on(
|
||||||
|
'change:name change:profileName change:profileFamilyName change:e164',
|
||||||
|
this.debouncedUpdateLastMessage,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
|
||||||
this.messageCollection = new window.Whisper.MessageCollection([], {
|
this.messageCollection = new window.Whisper.MessageCollection([], {
|
||||||
conversation: this,
|
conversation: this,
|
||||||
});
|
});
|
||||||
|
@ -226,12 +238,6 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
this.messageCollection.on('change:errors', this.handleMessageError, this);
|
this.messageCollection.on('change:errors', this.handleMessageError, this);
|
||||||
this.messageCollection.on('send-error', this.onMessageError, this);
|
this.messageCollection.on('send-error', this.onMessageError, this);
|
||||||
|
|
||||||
this.throttledBumpTyping = window._.throttle(this.bumpTyping, 300);
|
|
||||||
this.debouncedUpdateLastMessage = window._.debounce(
|
|
||||||
this.updateLastMessage.bind(this),
|
|
||||||
200
|
|
||||||
);
|
|
||||||
|
|
||||||
this.listenTo(
|
this.listenTo(
|
||||||
this.messageCollection,
|
this.messageCollection,
|
||||||
'add remove destroy content-changed',
|
'add remove destroy content-changed',
|
||||||
|
@ -258,6 +264,8 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
this.unset('hasFetchedProfile');
|
this.unset('hasFetchedProfile');
|
||||||
this.unset('tokens');
|
this.unset('tokens');
|
||||||
|
|
||||||
|
this.on('change:members change:membersV2', this.fetchContacts);
|
||||||
|
|
||||||
this.typingRefreshTimer = null;
|
this.typingRefreshTimer = null;
|
||||||
this.typingPauseTimer = null;
|
this.typingPauseTimer = null;
|
||||||
|
|
||||||
|
|
|
@ -559,10 +559,8 @@ export function _messageSelector(
|
||||||
_ourNumber: string,
|
_ourNumber: string,
|
||||||
_regionCode: string,
|
_regionCode: string,
|
||||||
interactionMode: 'mouse' | 'keyboard',
|
interactionMode: 'mouse' | 'keyboard',
|
||||||
|
_getConversationById: GetConversationByIdType,
|
||||||
_callsByConversation: CallsByConversationType,
|
_callsByConversation: CallsByConversationType,
|
||||||
_conversation?: ConversationType,
|
|
||||||
_author?: ConversationType,
|
|
||||||
_quoted?: ConversationType,
|
|
||||||
selectedMessageId?: string,
|
selectedMessageId?: string,
|
||||||
selectedMessageCounter?: number
|
selectedMessageCounter?: number
|
||||||
): TimelineItemType {
|
): TimelineItemType {
|
||||||
|
@ -598,10 +596,8 @@ type CachedMessageSelectorType = (
|
||||||
ourNumber: string,
|
ourNumber: string,
|
||||||
regionCode: string,
|
regionCode: string,
|
||||||
interactionMode: 'mouse' | 'keyboard',
|
interactionMode: 'mouse' | 'keyboard',
|
||||||
|
getConversationById: GetConversationByIdType,
|
||||||
callsByConversation: CallsByConversationType,
|
callsByConversation: CallsByConversationType,
|
||||||
conversation?: ConversationType,
|
|
||||||
author?: ConversationType,
|
|
||||||
quoted?: ConversationType,
|
|
||||||
selectedMessageId?: string,
|
selectedMessageId?: string,
|
||||||
selectedMessageCounter?: number
|
selectedMessageCounter?: number
|
||||||
) => TimelineItemType;
|
) => TimelineItemType;
|
||||||
|
@ -641,30 +637,13 @@ export const getMessageSelector = createSelector(
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { conversationId, source, type, quote } = message;
|
|
||||||
const conversation = conversationSelector(conversationId);
|
|
||||||
let author: ConversationType | undefined;
|
|
||||||
let quoted: ConversationType | undefined;
|
|
||||||
|
|
||||||
if (type === 'incoming') {
|
|
||||||
author = conversationSelector(source);
|
|
||||||
} else if (type === 'outgoing') {
|
|
||||||
author = conversationSelector(ourNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (quote && (quote.author || quote.authorUuid)) {
|
|
||||||
quoted = conversationSelector(quote.authorUuid || quote.author);
|
|
||||||
}
|
|
||||||
|
|
||||||
return messageSelector(
|
return messageSelector(
|
||||||
message,
|
message,
|
||||||
ourNumber,
|
ourNumber,
|
||||||
regionCode,
|
regionCode,
|
||||||
interactionMode,
|
interactionMode,
|
||||||
|
conversationSelector,
|
||||||
callsByConversation,
|
callsByConversation,
|
||||||
conversation,
|
|
||||||
author,
|
|
||||||
quoted,
|
|
||||||
selectedMessage ? selectedMessage.id : undefined,
|
selectedMessage ? selectedMessage.id : undefined,
|
||||||
selectedMessage ? selectedMessage.counter : undefined
|
selectedMessage ? selectedMessage.counter : undefined
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue