mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-02 13:49:59 +01:00
(refs #1286) Show group marker when collaborator is added
This commit is contained in:
@@ -118,12 +118,13 @@ trait IndexControllerBase extends ControllerBase {
|
||||
})
|
||||
|
||||
/**
|
||||
* JSON API for checking user existence.
|
||||
* JSON API for checking user or group existence.
|
||||
* Returns a single string which is any of "group", "user" or "".
|
||||
*/
|
||||
post("/_user/existence")(usersOnly {
|
||||
getAccountByUserName(params("userName")).map { account =>
|
||||
if(params.get("userOnly").isDefined) !account.isGroupAccount else true
|
||||
} getOrElse false
|
||||
if(account.isGroupAccount) "group" else "user"
|
||||
} getOrElse ""
|
||||
})
|
||||
|
||||
// TODO Move to RepositoryViwerController?
|
||||
|
||||
@@ -80,15 +80,14 @@ $(function(){
|
||||
}
|
||||
|
||||
// check existence
|
||||
$.post('@context.path/_user/existence', {
|
||||
'userName': userName
|
||||
}, function(data, status){
|
||||
if(data == 'true'){
|
||||
addMemberHTML(userName, false);
|
||||
} else {
|
||||
$('#error-members').text('User does not exist.');
|
||||
}
|
||||
});
|
||||
$.post('@context.path/_user/existence', { 'userName': userName },
|
||||
function(data, status){
|
||||
if(data == 'user'){
|
||||
addMemberHTML(userName, false);
|
||||
} else {
|
||||
$('#error-members').text('User does not exist.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.remove', function(){
|
||||
|
||||
@@ -75,16 +75,14 @@ $(function(){
|
||||
}
|
||||
|
||||
// check existence
|
||||
$.post('@context.path/_user/existence', {
|
||||
'userName': userName,
|
||||
'userOnly': true
|
||||
}, function(data, status){
|
||||
if(data == 'true'){
|
||||
addMemberHTML(userName, false);
|
||||
} else {
|
||||
$('#error-members').text('User does not exist.');
|
||||
}
|
||||
});
|
||||
$.post('@context.path/_user/existence', { 'userName': userName },
|
||||
function(data, status){
|
||||
if(data == 'user'){
|
||||
addMemberHTML(userName, false);
|
||||
} else {
|
||||
$('#error-members').text('User does not exist.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.remove', function(){
|
||||
|
||||
@@ -48,15 +48,14 @@ $(function(){
|
||||
}
|
||||
|
||||
// check existence
|
||||
$.post('@context.path/_user/existence', {
|
||||
'userName': userName
|
||||
}, function(data, status){
|
||||
if(data == 'true'){
|
||||
addCollaboratorHTML(userName, '@Permission.ADMIN.name'); // TODO isGroup
|
||||
} else {
|
||||
$('#error-collaborators').text('User does not exist.');
|
||||
}
|
||||
});
|
||||
$.post('@context.path/_user/existence', { 'userName': userName },
|
||||
function(data, status){
|
||||
if(data != ''){
|
||||
addCollaboratorHTML(userName, '@Permission.ADMIN.name', data == 'group');
|
||||
} else {
|
||||
$('#error-collaborators').text('User does not exist.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.remove', function(){
|
||||
|
||||
Reference in New Issue
Block a user