Archive Conversation

This commit is contained in:
Scott Nonnenberg 2019-03-11 17:20:16 -07:00
parent d72f89d776
commit 6ffbc0ac06
20 changed files with 568 additions and 109 deletions

View file

@ -312,6 +312,7 @@
const result = {
id: this.id,
isArchived: this.get('isArchived'),
activeAt: this.get('active_at'),
avatarPath: this.getAvatarPath(),
color,
@ -889,6 +890,7 @@
lastMessageStatus: 'sending',
active_at: now,
timestamp: now,
isArchived: false,
});
await window.Signal.Data.updateConversation(this.id, this.attributes, {
Conversation: Whisper.Conversation,
@ -1170,6 +1172,13 @@
}
},
async setArchived(isArchived) {
this.set({ isArchived });
await window.Signal.Data.updateConversation(this.id, this.attributes, {
Conversation: Whisper.Conversation,
});
},
async updateExpirationTimer(
providedExpireTimer,
providedSource,

View file

@ -1645,10 +1645,10 @@
c.onReadMessage(message);
}
} else {
conversation.set(
'unreadCount',
conversation.get('unreadCount') + 1
);
conversation.set({
unreadCount: conversation.get('unreadCount') + 1,
isArchived: false,
});
}
}

View file

@ -1,7 +1,6 @@
/* global Signal:false */
/* global Backbone: false */
/* global ConversationController: false */
/* global drawAttention: false */
/* global i18n: false */
/* global isFocused: false */

View file

@ -185,9 +185,12 @@
profileName: this.model.getProfileName(),
color: this.model.getColor(),
avatarPath: this.model.getAvatarPath(),
isVerified: this.model.isVerified(),
isMe: this.model.isMe(),
isGroup: !this.model.isPrivate(),
isArchived: this.model.get('isArchived'),
expirationSettingName,
showBackButton: Boolean(this.panels && this.panels.length),
timerOptions: Whisper.ExpirationTimerOptions.map(item => ({
@ -217,6 +220,14 @@
this.resetPanel();
this.updateHeader();
},
onArchive: () => {
this.unload();
this.model.setArchived(true);
},
onMoveToInbox: () => {
this.model.setArchived(false);
},
};
};
this.titleView = new Whisper.ReactWrapperView({

View file

@ -220,7 +220,7 @@
window.location.reload();
},
async openConversation(id, messageId) {
const conversation = await window.ConversationController.getOrCreateAndWait(
const conversation = await ConversationController.getOrCreateAndWait(
id,
'private'
);