handle profile properly if primaryDevicePubKey is not set

pull/827/head
Ryan Tharp 6 years ago
parent 60259ab0bb
commit 5feee5dd5f

@ -216,7 +216,9 @@ class LokiAppDotNetServerAPI {
// get our profile name // get our profile name
// this should be primaryDevicePubKey // this should be primaryDevicePubKey
// because the rest of the profile system uses that... // because the rest of the profile system uses that...
const ourNumber = window.storage.get('primaryDevicePubKey'); const ourNumber =
window.storage.get('primaryDevicePubKey') ||
textsecure.storage.user.getNumber();
const profileConvo = ConversationController.get(ourNumber); const profileConvo = ConversationController.get(ourNumber);
const profile = profileConvo.getLokiProfile(); const profile = profileConvo.getLokiProfile();
const profileName = profile && profile.displayName; const profileName = profile && profile.displayName;
@ -1028,7 +1030,7 @@ class LokiPublicChannelAPI {
// if we encountered problems then we'll keep the old mod status // if we encountered problems then we'll keep the old mod status
if (moderators) { if (moderators) {
this.modStatus = this.modStatus =
moderators.includes(ourNumberProfile) || (ourNumberProfile && moderators.includes(ourNumberProfile)) ||
moderators.includes(ourNumberDevice); moderators.includes(ourNumberDevice);
} }
@ -1432,8 +1434,10 @@ class LokiPublicChannelAPI {
let pendingMessages = []; let pendingMessages = [];
// get our profile name // get our profile name
const ourNumberProfile = window.storage.get('primaryDevicePubKey');
const ourNumberDevice = textsecure.storage.user.getNumber(); const ourNumberDevice = textsecure.storage.user.getNumber();
// if no primaryDevicePubKey fall back to ourNumberDevice
const ourNumberProfile =
window.storage.get('primaryDevicePubKey') || ourNumberDevice;
let lastProfileName = false; let lastProfileName = false;
// the signature forces this to be async // the signature forces this to be async

Loading…
Cancel
Save