Skip to content

Commit e675db6

Browse files
Stops showing duplicate generic autolink in details view when enriched version is displayed
1 parent eec532f commit e675db6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/webviews/apps/commitDetails/components/gl-commit-details.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,35 @@ export class GlCommitDetails extends GlDetailsBase {
212212
| { type: 'pr'; value: Serialized<PullRequestShape> }
213213
>();
214214

215+
const autolinkIdsByUrl = new Map<string, string>();
216+
215217
if (this.state?.commit?.autolinks != null) {
216218
for (const autolink of this.state.commit.autolinks) {
217219
deduped.set(autolink.id, { type: 'autolink', value: autolink });
220+
autolinkIdsByUrl.set(autolink.url, autolink.id);
218221
}
219222
}
220223

221224
if (this.state?.autolinkedIssues != null) {
222225
for (const issue of this.state.autolinkedIssues) {
223226
deduped.set(issue.id, { type: 'issue', value: issue });
227+
if (issue.url != null) {
228+
const autoLinkId = autolinkIdsByUrl.get(issue.url);
229+
if (autoLinkId != null) {
230+
deduped.delete(autoLinkId);
231+
}
232+
}
224233
}
225234
}
226235

227236
if (this.state?.pullRequest != null) {
228237
deduped.set(this.state.pullRequest.id, { type: 'pr', value: this.state.pullRequest });
238+
if (this.state.pullRequest.url != null) {
239+
const autoLinkId = autolinkIdsByUrl.get(this.state.pullRequest.url);
240+
if (autoLinkId != null) {
241+
deduped.delete(autoLinkId);
242+
}
243+
}
229244
}
230245

231246
const autolinks: Serialized<Autolink>[] = [];

0 commit comments

Comments
 (0)