Skip to content

Commit

Permalink
Allow WorkPackage memberships to be included in user mention autocomp…
Browse files Browse the repository at this point in the history
…letion

NOTE: There's de-duplication work to be done at this layer until
signaling can de-duplicate at the database layer. There's already
planned discussions on how to solve this but in the meantime, we need
to de-duplicate Principals at our CKEditor level.
  • Loading branch information
aaron-contreras authored and oliverguenther committed Nov 23, 2023
1 parent 1bedaa9 commit d9dc9ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mentions/user-mentions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export function userMentions(queryText) {
return [];
}

const project_id = getOPHelper(editor, 'idFromLink')(resource.project.href);
const url = getOPPath(editor).api.v3.principals(project_id, queryText) + '&select=elements/_type,elements/id,elements/name';
const workPackageId = getOPHelper(editor, 'idFromLink')(resource.href);
const url = getOPPath(editor).api.v3.principals(workPackageId, queryText) + '&select=elements/_type,elements/id,elements/name';
const pluginContext = getPluginContext(editor);
const base = window.OpenProject.urlRoot;

return new Promise((resolve, reject) => {
jQuery.getJSON(url, collection => {
resolve(collection._embedded.elements.map(mention => {
resolve(_.uniqBy(collection._embedded.elements, (el) => el.id).map(mention => {
const type = mention._type.toLowerCase();
const text = `@${mention.name}`;
const id = `@${mention.id}`;
Expand Down

0 comments on commit d9dc9ae

Please sign in to comment.