From 5beb6106c911daded65b069bdd97c14822e47983 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Tue, 7 Jun 2016 12:36:07 -0500 Subject: [PATCH] fix: Go to loaded party page when inviting friends to party --- website/client/js/controllers/inviteToGroupCtrl.js | 9 ++++----- website/client/js/services/groupServices.js | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/website/client/js/controllers/inviteToGroupCtrl.js b/website/client/js/controllers/inviteToGroupCtrl.js index a986cd768c..a4b8495a27 100644 --- a/website/client/js/controllers/inviteToGroupCtrl.js +++ b/website/client/js/controllers/inviteToGroupCtrl.js @@ -48,14 +48,13 @@ habitrpg.controller('InviteToGroupCtrl', ['$scope', '$rootScope', 'User', 'Group .then(function() { Notification.text(window.env.t('invitationsSent')); _resetInvitees(); - var redirectTo = '/#/options/groups/' if ($scope.group.type === 'party') { - redirectTo += 'party'; - } else { - redirectTo += ('guilds/' + $scope.group._id); + Groups.removePartyCache(); + $rootScope.$state.go('options.social.party'); + return; } - $rootScope.hardRedirect(redirectTo); + $rootScope.hardRedirect('/#/options/groups/guilds/' + $scope.group._id); }, function(){ _resetInvitees(); }); diff --git a/website/client/js/services/groupServices.js b/website/client/js/services/groupServices.js index 1411e5e2cb..c3f74ca0f8 100644 --- a/website/client/js/services/groupServices.js +++ b/website/client/js/services/groupServices.js @@ -110,6 +110,7 @@ angular.module('habitrpg') //On page load, multiple controller request the party. //So, we cache the promise until the first result is returned var _cachedPartyPromise; + function party (forceUpdate) { if (_cachedPartyPromise && !forceUpdate) return _cachedPartyPromise.promise; _cachedPartyPromise = $q.defer(); @@ -150,6 +151,10 @@ angular.module('habitrpg') return _cachedPartyPromise.promise; } + function removePartyCache () { + _cachedPartyPromise = null; + } + function publicGuilds () { var deferred = $q.defer(); @@ -207,8 +212,10 @@ angular.module('habitrpg') function inviteOrStartParty (group) { Analytics.track({'hitType':'event','eventCategory':'button','eventAction':'click','eventLabel':'Invite Friends'}); + if (group.type === "party" || $location.$$path === "/options/groups/party") { group.type = 'party'; + $rootScope.openModal('invite-party', { controller:'InviteToGroupCtrl', resolve: { @@ -227,6 +234,7 @@ angular.module('habitrpg') myGuilds: myGuilds, tavern: tavern, inviteOrStartParty: inviteOrStartParty, + removePartyCache: removePartyCache, data: data, Group: Group,