|
|
|
@ -297,34 +297,42 @@
|
|
|
|
|
// It doesn't need anything right now!
|
|
|
|
|
return {};
|
|
|
|
|
},
|
|
|
|
|
getPropsForFriendRequest() {
|
|
|
|
|
const friendStatus = this.get('friendStatus') || 'pending';
|
|
|
|
|
const direction = this.get('direction') || 'incoming';
|
|
|
|
|
|
|
|
|
|
async acceptFriendRequest() {
|
|
|
|
|
if (this.get('friendStatus') !== 'pending') return;
|
|
|
|
|
const conversation = this.getConversation();
|
|
|
|
|
|
|
|
|
|
const onAccept = async () => {
|
|
|
|
|
this.set({ friendStatus: 'accepted' });
|
|
|
|
|
await window.Signal.Data.saveMessage(this.attributes, {
|
|
|
|
|
Message: Whisper.Message,
|
|
|
|
|
});
|
|
|
|
|
this.set({ friendStatus: 'accepted' });
|
|
|
|
|
await window.Signal.Data.saveMessage(this.attributes, {
|
|
|
|
|
Message: Whisper.Message,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
window.Whisper.events.trigger('friendRequestUpdated', {
|
|
|
|
|
pubKey: conversation.id,
|
|
|
|
|
...this.attributes,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
window.Whisper.events.trigger('friendRequestUpdated', {
|
|
|
|
|
pubKey: conversation.id,
|
|
|
|
|
...this.attributes,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
async declineFriendRequest() {
|
|
|
|
|
if (this.get('friendStatus') !== 'pending') return;
|
|
|
|
|
const conversation = this.getConversation();
|
|
|
|
|
|
|
|
|
|
const onDecline = async () => {
|
|
|
|
|
this.set({ friendStatus: 'declined' });
|
|
|
|
|
await window.Signal.Data.saveMessage(this.attributes, {
|
|
|
|
|
Message: Whisper.Message,
|
|
|
|
|
});
|
|
|
|
|
this.set({ friendStatus: 'declined' });
|
|
|
|
|
await window.Signal.Data.saveMessage(this.attributes, {
|
|
|
|
|
Message: Whisper.Message,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
window.Whisper.events.trigger('friendRequestUpdated', {
|
|
|
|
|
pubKey: conversation.id,
|
|
|
|
|
...this.attributes,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
window.Whisper.events.trigger('friendRequestUpdated', {
|
|
|
|
|
pubKey: conversation.id,
|
|
|
|
|
...this.attributes,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getPropsForFriendRequest() {
|
|
|
|
|
const friendStatus = this.get('friendStatus') || 'pending';
|
|
|
|
|
const direction = this.get('direction') || 'incoming';
|
|
|
|
|
const conversation = this.getConversation();
|
|
|
|
|
|
|
|
|
|
const onAccept = () => this.acceptFriendRequest();
|
|
|
|
|
const onDecline = () => this.declineFriendRequest()
|
|
|
|
|
|
|
|
|
|
const onDeleteConversation = async () => {
|
|
|
|
|
// Delete the whole conversation
|
|
|
|
|