mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
more fixes for guild leaving
This commit is contained in:
parent
126fd55ec6
commit
33c78c7168
1 changed files with 2 additions and 4 deletions
|
|
@ -169,12 +169,10 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
||||||
if (confirm("Are you sure you want to leave this guild?") !== true) {
|
if (confirm("Are you sure you want to leave this guild?") !== true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
group.$leave(function(group){
|
group.$leave(function(){
|
||||||
$scope.groups.guilds.splice(_.indexOf($scope.groups.guilds, group), 1);
|
$scope.groups.guilds.splice(_.indexOf($scope.groups.guilds, group), 1);
|
||||||
// remove user from group members if guild is public so that he can re-join it immediately
|
// remove user from group members if guild is public so that he can re-join it immediately
|
||||||
if(group.privacy == 'public'){
|
if(group.privacy == 'public' || !group.privacy){ //public guilds with only some fields fetched
|
||||||
// slow when a lot of members...? probably yes
|
|
||||||
//_.remove(group.members, {_id: User.user._id}); Not necessary client side
|
|
||||||
var i = _.findIndex($scope.groups.public, {_id: group._id});
|
var i = _.findIndex($scope.groups.public, {_id: group._id});
|
||||||
if(~i){
|
if(~i){
|
||||||
var guild = $scope.groups.public[i];
|
var guild = $scope.groups.public[i];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue