Merge pull request #7 from crookedneighbor/hairlessbear-quest_invite_modal_on_user_sync

Make party page sync the party automatically (includes hacky fix for #4816)
This commit is contained in:
hairlessbear 2015-06-14 22:27:32 -04:00
commit 05effefef1
2 changed files with 13 additions and 2 deletions

View file

@ -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);
}
@ -509,11 +514,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.$syncParty(); // Sync party automatically when navigating to party page
}
Chat.seenMessage($scope.group._id);
$scope.create = function(group){

View file

@ -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'},