Skip to content

Commit

Permalink
Sort special icons before per-site when editing links
Browse files Browse the repository at this point in the history
On the sidebar, we only show the default per-site icon if none of the
special icons apply. On the editing page, we were doing the other way
around. Consolidating it seems sensible and if so we should do
the special icons first, since overriding per-page ones is part
of their whole point.
  • Loading branch information
reosarevok committed Nov 7, 2024
1 parent 0a17108 commit a82ec58
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions root/static/scripts/edit/externalLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1429,13 +1429,7 @@ export class ExternalLink extends React.Component<LinkProps> {
const firstLink = props.relationships[0];

let faviconClass: string | void;
for (const key of Object.keys(FAVICON_CLASSES)) {
if (props.url.indexOf(key) > 0) {
faviconClass = FAVICON_CLASSES[key];
break;
}
}
if (notEmpty && !faviconClass) {
if (notEmpty) {
const isHomepage = props.relationships.some(link => {
const linkType = link.type
? linkedEntities.link_type[link.type]
Expand Down Expand Up @@ -1472,7 +1466,15 @@ export class ExternalLink extends React.Component<LinkProps> {
if (isReview) {
faviconClass = 'review';
} else {
faviconClass = 'no';
for (const key of Object.keys(FAVICON_CLASSES)) {
if (props.url.indexOf(key) > 0) {
faviconClass = FAVICON_CLASSES[key];
break;
}
}
if (!faviconClass) {
faviconClass = 'no';
}
}
}
}
Expand Down

0 comments on commit a82ec58

Please sign in to comment.