Add autocompletion in textarea for user mentions

This commit is contained in:
Frederic Guillot
2015-12-29 18:44:21 +01:00
parent b4c5e36ee4
commit 178eda1887
18 changed files with 2773 additions and 7 deletions

View File

@@ -43,6 +43,25 @@ class ProjectPermission extends Base
);
}
/**
* Get all usernames (fetch users from groups)
*
* @access public
* @param integer $project_id
* @param string $input
* @return array
*/
public function findUsernames($project_id, $input)
{
$userMembers = $this->projectUserRoleFilter->create()->filterByProjectId($project_id)->startWithUsername($input)->findAll('username');
$groupMembers = $this->projectGroupRoleFilter->create()->filterByProjectId($project_id)->startWithUsername($input)->findAll('username');
$members = array_unique(array_merge($userMembers, $groupMembers));
sort($members);
return $members;
}
/**
* Return true if everybody is allowed for the project
*