mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
fix: Go to loaded party page when inviting friends to party
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user