DRY up ConversationView callbacks
This commit is contained in:
parent
86d2a4b5dd
commit
814255c10e
1 changed files with 20 additions and 42 deletions
|
@ -620,49 +620,22 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
micCellEl,
|
micCellEl,
|
||||||
attachmentListEl,
|
attachmentListEl,
|
||||||
onAccept: () => {
|
onAccept: () => {
|
||||||
this.longRunningTaskWrapper({
|
this.syncMessageRequestResponse('onAccept', messageRequestEnum.ACCEPT);
|
||||||
name: 'onAccept',
|
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
|
||||||
this.model,
|
|
||||||
messageRequestEnum.ACCEPT
|
|
||||||
),
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onBlock: () => {
|
onBlock: () => {
|
||||||
this.longRunningTaskWrapper({
|
this.syncMessageRequestResponse('onBlock', messageRequestEnum.BLOCK);
|
||||||
name: 'onBlock',
|
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
|
||||||
this.model,
|
|
||||||
messageRequestEnum.BLOCK
|
|
||||||
),
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onUnblock: () => {
|
onUnblock: () => {
|
||||||
this.longRunningTaskWrapper({
|
this.syncMessageRequestResponse('onUnblock', messageRequestEnum.ACCEPT);
|
||||||
name: 'onUnblock',
|
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
|
||||||
this.model,
|
|
||||||
messageRequestEnum.ACCEPT
|
|
||||||
),
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onDelete: () => {
|
onDelete: () => {
|
||||||
this.longRunningTaskWrapper({
|
this.syncMessageRequestResponse('onDelete', messageRequestEnum.DELETE);
|
||||||
name: 'onDelete',
|
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
|
||||||
this.model,
|
|
||||||
messageRequestEnum.DELETE
|
|
||||||
),
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onBlockAndDelete: () => {
|
onBlockAndDelete: () => {
|
||||||
this.longRunningTaskWrapper({
|
this.syncMessageRequestResponse(
|
||||||
name: 'onBlockAndDelete',
|
'onBlockAndDelete',
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
|
||||||
this.model,
|
|
||||||
messageRequestEnum.BLOCK_AND_DELETE
|
messageRequestEnum.BLOCK_AND_DELETE
|
||||||
),
|
);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onStartGroupMigration: () => this.startMigrationToGV2(),
|
onStartGroupMigration: () => this.startMigrationToGV2(),
|
||||||
onCancelJoinRequest: async () => {
|
onCancelJoinRequest: async () => {
|
||||||
|
@ -1421,6 +1394,17 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
syncMessageRequestResponse(
|
||||||
|
name: string,
|
||||||
|
messageRequestType: number
|
||||||
|
): Promise<void> {
|
||||||
|
const { model }: { model: ConversationModel } = this;
|
||||||
|
return this.longRunningTaskWrapper({
|
||||||
|
name,
|
||||||
|
task: model.syncMessageRequestResponse.bind(model, messageRequestType),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getPropsForAttachmentList() {
|
getPropsForAttachmentList() {
|
||||||
const draftAttachments = this.model.get('draftAttachments') || [];
|
const draftAttachments = this.model.get('draftAttachments') || [];
|
||||||
|
|
||||||
|
@ -3075,13 +3059,7 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
};
|
};
|
||||||
|
|
||||||
const onBlock = () => {
|
const onBlock = () => {
|
||||||
this.longRunningTaskWrapper({
|
this.syncMessageRequestResponse('onBlock', messageRequestEnum.BLOCK);
|
||||||
name: 'onBlock',
|
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
|
||||||
this.model,
|
|
||||||
messageRequestEnum.BLOCK
|
|
||||||
),
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ACCESS_ENUM = window.textsecure.protobuf.AccessControl.AccessRequired;
|
const ACCESS_ENUM = window.textsecure.protobuf.AccessControl.AccessRequired;
|
||||||
|
|
Loading…
Add table
Reference in a new issue