mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Show about info from contact profiles
This commit is contained in:
committed by
Scott Nonnenberg
parent
c8b551edab
commit
258bd55dd2
@@ -1173,6 +1173,7 @@ export class ConversationModel extends window.Backbone.Model<
|
||||
uuid: this.get('uuid'),
|
||||
e164: this.get('e164'),
|
||||
|
||||
about: this.getAboutText(),
|
||||
acceptedMessageRequest: this.getAccepted(),
|
||||
activeAt: this.get('active_at')!,
|
||||
areWePending: Boolean(
|
||||
@@ -1884,6 +1885,17 @@ export class ConversationModel extends window.Backbone.Model<
|
||||
return !this.get('profileSharing');
|
||||
}
|
||||
|
||||
getAboutText(): string | undefined {
|
||||
if (!this.get('about')) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return window.i18n('message--getNotificationText--text-with-emoji', {
|
||||
text: this.get('about'),
|
||||
emoji: this.get('aboutEmoji'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this conversation should be considered "accepted" in terms
|
||||
* of message requests
|
||||
@@ -3755,6 +3767,30 @@ export class ConversationModel extends window.Backbone.Model<
|
||||
});
|
||||
}
|
||||
|
||||
if (profile.about) {
|
||||
const key = this.get('profileKey');
|
||||
if (key) {
|
||||
const keyBuffer = base64ToArrayBuffer(key);
|
||||
const decrypted = await window.textsecure.crypto.decryptProfile(
|
||||
base64ToArrayBuffer(profile.about),
|
||||
keyBuffer
|
||||
);
|
||||
this.set('about', stringFromBytes(decrypted));
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.aboutEmoji) {
|
||||
const key = this.get('profileKey');
|
||||
if (key) {
|
||||
const keyBuffer = base64ToArrayBuffer(key);
|
||||
const decrypted = await window.textsecure.crypto.decryptProfile(
|
||||
base64ToArrayBuffer(profile.aboutEmoji),
|
||||
keyBuffer
|
||||
);
|
||||
this.set('aboutEmoji', stringFromBytes(decrypted));
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.capabilities) {
|
||||
c.set({ capabilities: profile.capabilities });
|
||||
}
|
||||
@@ -3900,6 +3936,8 @@ export class ConversationModel extends window.Backbone.Model<
|
||||
`Setting sealedSender to UNKNOWN for conversation ${this.idForLogging()}`
|
||||
);
|
||||
this.set({
|
||||
about: undefined,
|
||||
aboutEmoji: undefined,
|
||||
profileAvatar: undefined,
|
||||
profileKey,
|
||||
profileKeyVersion: undefined,
|
||||
@@ -3943,6 +3981,8 @@ export class ConversationModel extends window.Backbone.Model<
|
||||
}
|
||||
|
||||
this.set({
|
||||
about: undefined,
|
||||
aboutEmoji: undefined,
|
||||
profileKey: undefined,
|
||||
profileKeyVersion: undefined,
|
||||
profileKeyCredential: null,
|
||||
|
||||
Reference in New Issue
Block a user