mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-10 19:32:02 +00:00
refactor and add e2e js tests
This commit is contained in:
parent
922cd52f1b
commit
1d0cff2368
7 changed files with 139 additions and 67 deletions
|
@ -2,13 +2,13 @@ import {GET} from '../modules/fetch.js';
|
|||
import {parseIssueHref, parseRepoOwnerPathInfo} from '../utils.js';
|
||||
|
||||
export function getIssueIcon(issue) {
|
||||
if (issue.pull_request) {
|
||||
if (issue.is_pr) {
|
||||
if (issue.state === 'open') {
|
||||
if (issue.pull_request.draft === true) {
|
||||
if (issue.draft === true) {
|
||||
return 'octicon-git-pull-request-draft'; // WIP PR
|
||||
}
|
||||
return 'octicon-git-pull-request'; // Open PR
|
||||
} else if (issue.pull_request.merged === true) {
|
||||
} else if (issue.merged === true) {
|
||||
return 'octicon-git-merge'; // Merged PR
|
||||
}
|
||||
return 'octicon-git-pull-request'; // Closed PR
|
||||
|
@ -19,10 +19,10 @@ export function getIssueIcon(issue) {
|
|||
}
|
||||
|
||||
export function getIssueColor(issue) {
|
||||
if (issue.pull_request) {
|
||||
if (issue.pull_request.draft === true) {
|
||||
if (issue.is_pr) {
|
||||
if (issue.draft === true) {
|
||||
return 'grey'; // WIP PR
|
||||
} else if (issue.pull_request.merged === true) {
|
||||
} else if (issue.merged === true) {
|
||||
return 'purple'; // Merged PR
|
||||
}
|
||||
}
|
||||
|
@ -44,9 +44,6 @@ export async function fetchIssueSuggestions() {
|
|||
issuePathInfo.repoName = repoOwnerPathInfo.repoName;
|
||||
// then no issuePathInfo.indexString here, it is only used to exclude the current issue when "matchIssue"
|
||||
}
|
||||
if (!issuePathInfo.ownerName) {
|
||||
throw new Error('unexpected');
|
||||
}
|
||||
|
||||
const res = await GET(`${window.config.appSubUrl}/${issuePathInfo.ownerName}/${issuePathInfo.repoName}/issues/suggestions`);
|
||||
const issues = await res.json();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue