Added force sync param to party and tavern requests

This commit is contained in:
Keith Holliday
2016-05-23 09:40:04 +01:00
parent c5215e80de
commit 63de1e398f
3 changed files with 21 additions and 11 deletions

View File

@@ -11,13 +11,20 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
$scope.inviteOrStartParty = Groups.inviteOrStartParty;
$scope.loadWidgets = Social.loadWidgets;
Groups.Group.syncParty()
.then(function successCallback(group) {
$rootScope.party = $scope.group = group;
checkForNotifications();
}, function errorCallback(response) {
$rootScope.party = $scope.group = $scope.newGroup = { type: 'party' };
});
function handlePartyResponse (group) {
$rootScope.party = $scope.group = group;
checkForNotifications();
}
function handlePartyError (response) {
$rootScope.party = $scope.group = $scope.newGroup = { type: 'party' };
}
if ($state.is('options.social.party')) {
Groups.party(true).then(handlePartyResponse, handlePartyError);
} else {
Groups.Group.syncParty().then(handlePartyResponse, handlePartyError);
}
function checkForNotifications () {
// Checks if user's party has reached 2 players for the first time.

View File

@@ -2,7 +2,7 @@
habitrpg.controller("TavernCtrl", ['$scope', 'Groups', 'User', 'Challenges',
function($scope, Groups, User, Challenges) {
Groups.tavern()
Groups.tavern(true)
.then(function (tavern) {
$scope.group = tavern;
Challenges.getGroupChallenges($scope.group._id)