feat: findMentionsInIssue uses Issue obj
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
f5fe8a90e5
commit
d43f1d29ca
2 changed files with 20 additions and 8 deletions
|
@ -65,9 +65,23 @@ test("comments API ", async () => {
|
|||
});
|
||||
|
||||
test("mentions in issue", async () => {
|
||||
expect(await api.findMentionsInIssue(username, repo, 1)).toBe(true);
|
||||
expect(await api.findMentionsInIssue(username, repo, 2)).toBe(true);
|
||||
expect(await api.findMentionsInIssue(username, repo, 3)).toBe(true);
|
||||
expect(await api.findMentionsInIssue(username, repo, 4)).toBe(true);
|
||||
expect(await api.findMentionsInIssue(username, repo, 5)).toBe(false);
|
||||
let issue = await api.getIssue(username, repo, 1);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 2);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 3);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 4);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 5);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(false);
|
||||
});
|
||||
|
|
|
@ -117,9 +117,7 @@ class Forgejo {
|
|||
/**
|
||||
* Check if logged in user is mentioned in the issue
|
||||
*/
|
||||
async findMentionsInIssue(owner: string, repo: string, id: number) {
|
||||
let issue = await this.getIssue(owner, repo, id);
|
||||
issue = await this.getCommentsForIssue(issue);
|
||||
async findMentionsInIssue(issue: Issue) {
|
||||
let unreadTime = this.lastReadTime(issue);
|
||||
|
||||
const mentionUtil = (str: string): boolean => {
|
||||
|
|
Loading…
Reference in a new issue