mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-05 19:30:58 +00:00
feat: add issue suggestions
This commit is contained in:
parent
5e9e146545
commit
3d4372c8bf
11 changed files with 302 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
|||
import emojis from '../../../assets/emoji.json';
|
||||
import {GET} from '../modules/fetch.js';
|
||||
|
||||
|
||||
const maxMatches = 6;
|
||||
|
||||
|
@ -41,3 +43,13 @@ export function matchMention(queryText) {
|
|||
|
||||
return sortAndReduce(results);
|
||||
}
|
||||
|
||||
export async function matchIssue(owner, repo, issueIndexStr, query) {
|
||||
const res = await GET(`${window.config.appSubUrl}/${owner}/${repo}/issues/suggestions?q=${encodeURIComponent(query)}`);
|
||||
|
||||
const issues = await res.json();
|
||||
const issueIndex = parseInt(issueIndexStr);
|
||||
|
||||
// filter out issue with same id
|
||||
return issues.filter((i) => i.id !== issueIndex);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue