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() {
|
.then(function() {
|
||||||
Notification.text(window.env.t('invitationsSent'));
|
Notification.text(window.env.t('invitationsSent'));
|
||||||
_resetInvitees();
|
_resetInvitees();
|
||||||
var redirectTo = '/#/options/groups/'
|
|
||||||
if ($scope.group.type === 'party') {
|
if ($scope.group.type === 'party') {
|
||||||
redirectTo += 'party';
|
Groups.removePartyCache();
|
||||||
} else {
|
$rootScope.$state.go('options.social.party');
|
||||||
redirectTo += ('guilds/' + $scope.group._id);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.hardRedirect(redirectTo);
|
$rootScope.hardRedirect('/#/options/groups/guilds/' + $scope.group._id);
|
||||||
}, function(){
|
}, function(){
|
||||||
_resetInvitees();
|
_resetInvitees();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ angular.module('habitrpg')
|
|||||||
//On page load, multiple controller request the party.
|
//On page load, multiple controller request the party.
|
||||||
//So, we cache the promise until the first result is returned
|
//So, we cache the promise until the first result is returned
|
||||||
var _cachedPartyPromise;
|
var _cachedPartyPromise;
|
||||||
|
|
||||||
function party (forceUpdate) {
|
function party (forceUpdate) {
|
||||||
if (_cachedPartyPromise && !forceUpdate) return _cachedPartyPromise.promise;
|
if (_cachedPartyPromise && !forceUpdate) return _cachedPartyPromise.promise;
|
||||||
_cachedPartyPromise = $q.defer();
|
_cachedPartyPromise = $q.defer();
|
||||||
@@ -150,6 +151,10 @@ angular.module('habitrpg')
|
|||||||
return _cachedPartyPromise.promise;
|
return _cachedPartyPromise.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removePartyCache () {
|
||||||
|
_cachedPartyPromise = null;
|
||||||
|
}
|
||||||
|
|
||||||
function publicGuilds () {
|
function publicGuilds () {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
@@ -207,8 +212,10 @@ angular.module('habitrpg')
|
|||||||
|
|
||||||
function inviteOrStartParty (group) {
|
function inviteOrStartParty (group) {
|
||||||
Analytics.track({'hitType':'event','eventCategory':'button','eventAction':'click','eventLabel':'Invite Friends'});
|
Analytics.track({'hitType':'event','eventCategory':'button','eventAction':'click','eventLabel':'Invite Friends'});
|
||||||
|
|
||||||
if (group.type === "party" || $location.$$path === "/options/groups/party") {
|
if (group.type === "party" || $location.$$path === "/options/groups/party") {
|
||||||
group.type = 'party';
|
group.type = 'party';
|
||||||
|
|
||||||
$rootScope.openModal('invite-party', {
|
$rootScope.openModal('invite-party', {
|
||||||
controller:'InviteToGroupCtrl',
|
controller:'InviteToGroupCtrl',
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -227,6 +234,7 @@ angular.module('habitrpg')
|
|||||||
myGuilds: myGuilds,
|
myGuilds: myGuilds,
|
||||||
tavern: tavern,
|
tavern: tavern,
|
||||||
inviteOrStartParty: inviteOrStartParty,
|
inviteOrStartParty: inviteOrStartParty,
|
||||||
|
removePartyCache: removePartyCache,
|
||||||
|
|
||||||
data: data,
|
data: data,
|
||||||
Group: Group,
|
Group: Group,
|
||||||
|
|||||||
Reference in New Issue
Block a user