mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Ported groups service to user new api v3 and ported dependent controllers (#7108)
* Ported groups service to user new api v3 and ported dependent controllers * Remove and extra remove inviation code. Fixed group service caching and update group service tests * Fixed test logic and added party cache support * Added promise rejections and updated http interceptor
This commit is contained in:
committed by
Matteo Pagliazzi
parent
f2d5c921ed
commit
ea490c9a1f
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedGroup', '$http', 'Notification', function($scope, User, Groups, injectedGroup, $http, Notification) {
|
||||
habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedGroup', '$http', 'Notification',
|
||||
function($scope, User, Groups, injectedGroup, $http, Notification) {
|
||||
$scope.group = injectedGroup;
|
||||
|
||||
$scope.inviter = User.user.profile.name;
|
||||
@@ -17,8 +18,9 @@ habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedG
|
||||
$scope.inviteNewUsers = function(inviteMethod) {
|
||||
if (!$scope.group._id) {
|
||||
$scope.group.name = $scope.group.name || env.t('possessiveParty', {name: User.user.profile.name});
|
||||
return $scope.group.$save()
|
||||
.then(function(res) {
|
||||
return Groups.Group.create($scope.group)
|
||||
.then(function(response) {
|
||||
$scope.group = response.data.data;
|
||||
_inviteByMethod(inviteMethod);
|
||||
});
|
||||
}
|
||||
@@ -39,12 +41,13 @@ habitrpg.controller('InviteToGroupCtrl', ['$scope', 'User', 'Groups', 'injectedG
|
||||
return console.log('Invalid invite method.')
|
||||
}
|
||||
|
||||
Groups.Group.invite({gid: $scope.group._id}, invitationDetails, function(){
|
||||
Notification.text(window.env.t('invitationsSent'));
|
||||
_resetInvitees();
|
||||
}, function(){
|
||||
_resetInvitees();
|
||||
});
|
||||
Groups.Group.invite($scope.group._id, invitationDetails)
|
||||
.then(function() {
|
||||
Notification.text(window.env.t('invitationsSent'));
|
||||
_resetInvitees();
|
||||
}, function(){
|
||||
_resetInvitees();
|
||||
});
|
||||
}
|
||||
|
||||
function _getOnlyUuids() {
|
||||
|
||||
Reference in New Issue
Block a user