From bb73253e8e5c2382c3081dc9955e8b25561bdb73 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sun, 14 Jun 2015 19:26:01 -0500 Subject: [PATCH 1/2] Make party page sync the party automatically --- website/public/js/controllers/groupsCtrl.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/public/js/controllers/groupsCtrl.js b/website/public/js/controllers/groupsCtrl.js index 9b3324274a..fb53fac107 100644 --- a/website/public/js/controllers/groupsCtrl.js +++ b/website/public/js/controllers/groupsCtrl.js @@ -509,11 +509,16 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' .controller("PartyCtrl", ['$rootScope','$scope', 'Groups', 'Chat', 'User', 'Challenges', '$state', '$compile', function($rootScope,$scope, Groups, Chat, User, Challenges, $state, $compile) { + $scope.type = 'party'; $scope.text = window.env.t('party'); $scope.group = $rootScope.party = Groups.party(); $scope.newGroup = new Groups.Group({type:'party'}); + if ($state.is('options.social.party')) { + $scope.group.$get(); // Sync party automatically when navigating to party page + } + Chat.seenMessage($scope.group._id); $scope.create = function(group){ From 00c50f1212c1a51b826311c72a58f6544788b6a5 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sun, 14 Jun 2015 21:17:18 -0500 Subject: [PATCH 2/2] Fixes #4816 --- website/public/js/controllers/groupsCtrl.js | 11 ++++++++--- website/public/js/services/groupServices.js | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/website/public/js/controllers/groupsCtrl.js b/website/public/js/controllers/groupsCtrl.js index fb53fac107..f1e8603e3f 100644 --- a/website/public/js/controllers/groupsCtrl.js +++ b/website/public/js/controllers/groupsCtrl.js @@ -391,8 +391,13 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' }; $scope.sync = function(group){ - group.$get(); - //When the user clicks fetch recent messages we need to update that the user has seen the new messages + if(group.type == 'party') { + group.$syncParty(); // Syncs the whole party, not just 15 members + } else { + group.$get(); + } + // When the user clicks fetch recent messages we need to update + // that the user has seen the new messages Chat.seenMessage(group._id); } @@ -516,7 +521,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' $scope.newGroup = new Groups.Group({type:'party'}); if ($state.is('options.social.party')) { - $scope.group.$get(); // Sync party automatically when navigating to party page + $scope.group.$syncParty(); // Sync party automatically when navigating to party page } Chat.seenMessage($scope.group._id); diff --git a/website/public/js/services/groupServices.js b/website/public/js/services/groupServices.js index fcd80a619b..368c675123 100644 --- a/website/public/js/services/groupServices.js +++ b/website/public/js/services/groupServices.js @@ -23,6 +23,7 @@ function(ApiUrl, $resource, $q, $http, User, Challenges) { } }, + syncParty: {method: "GET", url: '/api/v2/groups/party'}, join: {method: "POST", url: ApiUrl.get() + '/api/v2/groups/:gid/join'}, leave: {method: "POST", url: ApiUrl.get() + '/api/v2/groups/:gid/leave'}, invite: {method: "POST", url: ApiUrl.get() + '/api/v2/groups/:gid/invite'},