Bug 955324 - Starting/stopping to follow someone doesn't update the participant list of the timeline. r=clokep a=rkent THUNDERBIRD452b1_2016051723_RELBRANCH
authorArlo Breault <arlolra@gmail.com>
Tue, 08 Mar 2016 20:20:53 -0500
branchTHUNDERBIRD452b1_2016051723_RELBRANCH
changeset 24567 0d176056e79528049c43c79ea29bef49344a79c0
parent 24566 f71972b90c3c27201a5f315c40e326df0221a971
child 24568 a953603f8460992aabe649856206b5a98a5d164c
push id1641
push userkent@caspia.com
push dateWed, 18 May 2016 07:34:32 +0000
treeherdercomm-beta@3d73a3597a7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep, rkent
bugs955324
Bug 955324 - Starting/stopping to follow someone doesn't update the participant list of the timeline. r=clokep a=rkent
chat/protocols/twitter/twitter.js
--- a/chat/protocols/twitter/twitter.js
+++ b/chat/protocols/twitter/twitter.js
@@ -565,16 +565,17 @@ Account.prototype = {
     // friendships/destroy will return the user in case of success.
     // Error cases would return a non 200 HTTP code and not call our callback.
     this.signAndSend("1.1/friendships/destroy.json", null,
                      [["screen_name", aUserName]], function(aData, aXHR) {
       let user = JSON.parse(aData);
       if (!("id_str" in user))
         return; // Unexpected response...
       this._friends.delete(user.id_str);
+      this.timeline.removeParticipant(user.screen_name);
       let date = aXHR.getResponseHeader("Date");
       this.timeline.systemMessage(_("event.unfollow", user.screen_name), false,
                                   new Date(date) / 1000);
     }, null, this);
   },
   addBuddy: function(aTag, aName) {
     this.follow(aName);
   },
@@ -771,19 +772,21 @@ Account.prototype = {
         // Overwrite the existing _friends list (if any).
         this._friends = new Set(msg.friends.map(aId => aId.toString()));
       }
       else if ("event" in msg) {
         let user, event;
         switch(msg.event) {
           case "follow":
             if (msg.source.screen_name == this.name) {
-              this._friends.add(msg.target.id_str);
               user = msg.target;
               event = "follow";
+              this.setUserInfo(user);
+              this._friends.add(user.id_str);
+              this.timeline._ensureParticipantExists(user.screen_name);
             }
             else if (msg.target.screen_name == this.name) {
               user = msg.source;
               event = "followed";
             }
             if (user) {
               this.setUserInfo(user);
               this.timeline.systemMessage(_("event." + event, user.screen_name),