fix(api): issue #1124
This commit is contained in:
parent
7a5f08cf83
commit
0821d179df
@ -32,10 +32,10 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done:
|
||||
const ua = new UAParser(userAgent ?? '').getResult();
|
||||
const hostname = new URL(url).hostname.split('.').slice(-3).join('.').replace('www.', '');
|
||||
const existingIssues = await octokit.request('GET /search/issues', {
|
||||
per_page: 1,
|
||||
per_page: 50,
|
||||
q: `in:title+is:issue+repo:${environment.github.owner}/${environment.github.repo}+${hostname}`,
|
||||
});
|
||||
const existingIssue = existingIssues.data.items[0];
|
||||
const existingIssue = existingIssues.data.items.find((issue) => hostname === issue.title);
|
||||
|
||||
try {
|
||||
if (existingIssue) {
|
||||
|
@ -23,17 +23,17 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done:
|
||||
try {
|
||||
const { hostname } = request.params;
|
||||
const existingIssues = await octokit.request('GET /search/issues', {
|
||||
per_page: 1,
|
||||
per_page: 50,
|
||||
q: `in:title+is:issue+repo:${environment.github.owner}/${environment.github.repo}+${hostname}`,
|
||||
});
|
||||
const existingIssue = existingIssues.data.items[0];
|
||||
const existingIssue = existingIssues.data.items.find(
|
||||
(issue) =>
|
||||
hostname === issue.title &&
|
||||
(issue.state === 'open' ||
|
||||
(issue.state === 'closed' && issue.labels.some((label) => label.name === 'wontfix')))
|
||||
);
|
||||
|
||||
if (
|
||||
existingIssue &&
|
||||
(existingIssue.state === 'open' ||
|
||||
(existingIssue.state === 'closed' &&
|
||||
existingIssue.labels.some((label) => label.name === 'wontfix')))
|
||||
) {
|
||||
if (existingIssue) {
|
||||
reply.send({
|
||||
data: {
|
||||
flags: existingIssue.labels.map((label) => label.name),
|
||||
|
Loading…
Reference in New Issue
Block a user