[polari/fix-nick-setting] entryArea: Fix setting new nick immediately



commit 29abb01374eddd5340aa58439b553791ea7347a4
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Nov 3 22:41:08 2017 +0100

    entryArea: Fix setting new nick immediately
    
    The intended behavior when changing the nick via the popover is to
    update the button label immediately, and only revert to the actually
    used nick when the server doesn't react in a reasonable time (or
    simply rejects the update).
    However 911b95582f1 broke that, as the account's nickname property
    changes right away , but isn't actually used to set the nick label
    while connected. In that case the label is set from the connection's
    self-contact, which will only pick up the new nick after it changed
    on the server.
    So to avoid resetting the newly requested nick immediately, only
    consider changes to the nickname while disconnected.

 src/entryArea.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 691f33d..2ffd30a 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -249,8 +249,10 @@ var EntryArea = GObject.registerClass({
             this._room.connect('members-changed',
                                Lang.bind(this, this._updateCompletions));
         this._nicknameChangedId =
-            this._room.account.connect('notify::nickname',
-                                       Lang.bind(this, this._updateNick));
+            this._room.account.connect('notify::nickname', () => {
+                if (!this._room.channel)
+                    this._updateNick();
+            });
         this._channelChangedId =
             this._room.connect('notify::channel',
                                Lang.bind(this, this._onChannelChanged));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]