diff --git a/background.html b/background.html
index aa30f06ea..f5a05f2e8 100644
--- a/background.html
+++ b/background.html
@@ -161,7 +161,7 @@
{{ #title }}
Register
diff --git a/js/background.js b/js/background.js
index 112c048c0..8df8adade 100644
--- a/js/background.js
+++ b/js/background.js
@@ -579,27 +579,15 @@
message: window.i18n('editProfileDisplayNameWarning'),
nickname: displayName,
onOk: async (newName) => {
- // Update our profiles accordingly'
- const trimmed = newName && newName.trim();
-
- // If we get an empty name then unset the name property
- // Otherwise update it
- const newProfile = profile || {};
- if (_.isEmpty(trimmed)) {
- delete newProfile.name;
- } else {
- newProfile.name = {
- displayName: trimmed,
- }
- }
-
- await storage.saveLocalProfile(newProfile);
+ await storage.setProfileName(newName);
appView.inboxView.trigger('updateProfile');
// Update the conversation if we have it
const conversation = ConversationController.get(ourNumber);
- if (conversation)
+ if (conversation) {
+ const newProfile = storage.getLocalProfile();
conversation.setProfile(newProfile);
+ }
},
})
}
diff --git a/js/models/profile.js b/js/models/profile.js
index 0fae1ecfb..cd8b6ec9b 100644
--- a/js/models/profile.js
+++ b/js/models/profile.js
@@ -16,6 +16,25 @@
return profile;
}
+ storage.setProfileName = async (newName) => {
+ // Update our profiles accordingly'
+ const trimmed = newName && newName.trim();
+
+ // If we get an empty name then unset the name property
+ // Otherwise update it
+ const profile = storage.getLocalProfile();
+ const newProfile = profile || {};
+ if (_.isEmpty(trimmed)) {
+ delete newProfile.name;
+ } else {
+ newProfile.name = {
+ displayName: trimmed,
+ }
+ }
+
+ await storage.saveLocalProfile(newProfile);
+ }
+
storage.saveLocalProfile = async (profile) => {
const storedProfile = storage.get(PROFILE_ID, null);
diff --git a/js/views/standalone_registration_view.js b/js/views/standalone_registration_view.js
index d10bec1b2..8a1676d97 100644
--- a/js/views/standalone_registration_view.js
+++ b/js/views/standalone_registration_view.js
@@ -1,4 +1,4 @@
-/* global Whisper, $, getAccountManager, textsecure */
+/* global Whisper, $, getAccountManager, textsecure, storage, ConversationController */
/* eslint-disable more/no-then */
@@ -47,7 +47,17 @@
this.accountManager
.registerSingleDevice(
this.$('#mnemonic').val(),
- this.$('#mnemonic-language').val()
+ this.$('#mnemonic-language').val(),
+ async (pubKey) => {
+ await storage.setProfileName(this.$('#display-name').val());
+
+ // Update the conversation if we have it
+ const conversation = ConversationController.get(pubKey);
+ if (conversation) {
+ const newProfile = storage.getLocalProfile();
+ conversation.setProfile(newProfile);
+ }
+ }
)
.then(() => {
this.$el.trigger('openInbox');
diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js
index 8c91f44af..35986676a 100644
--- a/libtextsecure/account_manager.js
+++ b/libtextsecure/account_manager.js
@@ -49,7 +49,7 @@
requestSMSVerification(number) {
// return this.server.requestVerificationSMS(number);
},
- registerSingleDevice(mnemonic, mnemonicLanguage) {
+ registerSingleDevice(mnemonic, mnemonicLanguage, callback) {
const createAccount = this.createAccount.bind(this);
const clearSessionsAndPreKeys = this.clearSessionsAndPreKeys.bind(this);
const generateKeys = this.generateKeys.bind(this, 0);
@@ -77,7 +77,8 @@
.then(confirmKeys)
.then(() => {
const pubKeyString = StringView.arrayBufferToHex(identityKeyPair.pubKey);
- registrationDone(pubKeyString)
+ registrationDone(pubKeyString);
+ callback(pubKeyString);
});
}
)
diff --git a/stylesheets/_global.scss b/stylesheets/_global.scss
index f642c51c0..1483bfe0d 100644
--- a/stylesheets/_global.scss
+++ b/stylesheets/_global.scss
@@ -647,6 +647,10 @@ textarea {
max-width: 35em;
}
+ #display-name {
+ margin-bottom: 12px;
+ }
+
.inner {
display: flex;
align-items: center;