mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-26 16:53:52 +00:00
better group invite handling
This commit is contained in:
parent
633ce62313
commit
6af71f0e44
3 changed files with 8 additions and 7 deletions
|
|
@ -59,11 +59,12 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
||||||
|
|
||||||
// ------ Invites ------
|
// ------ Invites ------
|
||||||
|
|
||||||
$scope.invitee = '';
|
$scope.invite = function(group){
|
||||||
$scope.invite = function(group, uuid){
|
group.$invite({uuid:group.invitee}, function(){
|
||||||
group.$invite({uuid:uuid}, function(){
|
group.invitee = '';
|
||||||
$scope.invitee = '';
|
|
||||||
alert("User invited to group");
|
alert("User invited to group");
|
||||||
|
}, function(){
|
||||||
|
group.invitee = '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ api.invite = function(req, res, next) {
|
||||||
User.findById(uuid, function(err,invite){
|
User.findById(uuid, function(err,invite){
|
||||||
if (err) return res.json(500,{err:err});
|
if (err) return res.json(500,{err:err});
|
||||||
if (!invite)
|
if (!invite)
|
||||||
return res.json(400,{err:'User with id '+req.query.uid+' not found'});
|
return res.json(400,{err:'User with id "' + uuid + '" not found'});
|
||||||
if (group.type == 'guild') {
|
if (group.type == 'guild') {
|
||||||
if (_.contains(group.members,uuid))
|
if (_.contains(group.members,uuid))
|
||||||
return res.json(400,{err: "User already in that group"});
|
return res.json(400,{err: "User already in that group"});
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,10 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
|
||||||
| {{username(member.auth, member.profile.name)}}
|
| {{username(member.auth, member.profile.name)}}
|
||||||
td ({{member._id}})
|
td ({{member._id}})
|
||||||
.modal-footer.whatever-options
|
.modal-footer.whatever-options
|
||||||
form.form-inline(ng-submit='invite(group, invitee)')
|
form.form-inline(ng-submit='invite(group)')
|
||||||
//.alert.alert-danger(ng-show='_groupError') {{_groupError}}
|
//.alert.alert-danger(ng-show='_groupError') {{_groupError}}
|
||||||
.control-group.option-large
|
.control-group.option-large
|
||||||
input.option-content(type='text', placeholder='User Id', ng-model='invitee')
|
input.option-content(type='text', placeholder='User Id', ng-model='group.invitee')
|
||||||
input.btn(type='submit', value='Invite')
|
input.btn(type='submit', value='Invite')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue