mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-03 12:40:00 +00:00
fix: Go to loaded party page when inviting friends to party
This commit is contained in:
parent
48957369f3
commit
5beb6106c9
2 changed files with 12 additions and 5 deletions
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue