Skip to content

Commit de98ab6

Browse files
committed
Normalizes Linear autlink URL by removing summary stubs from its ending
by doing that we fix duplication of Linear issue links in the Inspect View (#4605, #4621, #4622)
1 parent ee6eb93 commit de98ab6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/plus/integrations/providers/linear.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ export class LinearIntegration extends IssuesIntegration<IssuesCloudHostIntegrat
217217
_type: undefined | IssueOrPullRequestType,
218218
): Promise<IssueOrPullRequest | undefined> {
219219
const issue = await this.getRawProviderIssue(session, resource, id);
220-
return issue && toIssueShape(issue, this);
220+
const autolinkableIssue: ProviderIssue | undefined = issue && {
221+
...issue,
222+
url: this.getIssueAutolinkLikeUrl(issue),
223+
};
224+
return autolinkableIssue && toIssueShape(autolinkableIssue, this);
221225
}
222226
protected override async getProviderIssue(
223227
session: ProviderAuthenticationSession,
@@ -259,4 +263,13 @@ export class LinearIntegration extends IssuesIntegration<IssuesCloudHostIntegrat
259263
return undefined;
260264
}
261265
}
266+
private getIssueAutolinkLikeUrl(issue: ProviderIssue): string | null {
267+
const url = issue.url;
268+
if (url == null) return null;
269+
const lastSegment = url.split('/').pop();
270+
if (!lastSegment || issue.number === lastSegment) {
271+
return url;
272+
}
273+
return url.substring(0, url.length - lastSegment.length - 1);
274+
}
262275
}

0 commit comments

Comments
 (0)