From f28dead69288ac46a7b7ec8ccab96629c252ecd8 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Tue, 6 Sep 2016 11:18:52 +0200 Subject: [PATCH] do not sync party every time the page is opened, update chat in realtime --- website/client/js/controllers/partyCtrl.js | 2 +- website/client/js/services/pusherService.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/website/client/js/controllers/partyCtrl.js b/website/client/js/controllers/partyCtrl.js index c4cd345358..c7ddc42908 100644 --- a/website/client/js/controllers/partyCtrl.js +++ b/website/client/js/controllers/partyCtrl.js @@ -28,7 +28,7 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User',' } if ($state.is('options.social.party') && $rootScope.party && $rootScope.party.id) { - Groups.party(true).then(handlePartyResponse, handlePartyError); + Groups.party().then(handlePartyResponse, handlePartyError); } else { Groups.Group.syncParty().then(handlePartyResponse, handlePartyError); } diff --git a/website/client/js/services/pusherService.js b/website/client/js/services/pusherService.js index 70bed993ad..ebe1b17354 100644 --- a/website/client/js/services/pusherService.js +++ b/website/client/js/services/pusherService.js @@ -98,8 +98,9 @@ angular.module('habitrpg') // When a new chat message is posted partyChannel.bind('new-chat', function (data) { Groups.party().then(function () { - // Groups.data.party.chat.unshift(data); - // Groups.data.party.chat.splice(200); + // Update the party data + Groups.data.party.chat.unshift(data); + Groups.data.party.chat.splice(200); }); }); };