Skip to content

Commit

Permalink
Fix inconsistent show-names color (#4851)
Browse files Browse the repository at this point in the history
Co-authored-by: Federico Brigante <me@fregante.com>
Co-authored-by: Kid <kidonng@gmail.com>
  • Loading branch information
3 people committed Oct 4, 2021
1 parent a5f9d79 commit 58fa640
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions source/features/show-names.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ async function init(): Promise<false | void> {
const userKey = api.escapeKey(username);

// For the currently logged in user, `names[userKey]` would not be present.
if (names[userKey]?.name) {
const {name} = names[userKey] ?? {};

if (name) {
// If it's a regular comment author, add it outside <strong>
// otherwise it's something like "User added some commits"
if (compareNames(username, names[userKey].name)) {
usernameElement.textContent = names[userKey].name;
if (compareNames(username, name)) {
usernameElement.textContent = name;
} else {
const insertionPoint = usernameElement.parentElement!.tagName === 'STRONG' ? usernameElement.parentElement! : usernameElement;
const insertionPoint = usernameElement.parentElement!.tagName === 'STRONG'
? usernameElement.parentElement!
: usernameElement;
insertionPoint.after(
' (',
<bdo className="css-truncate d-inline-block">
<span className="css-truncate-target" style={{maxWidth: '200px'}}>
{names[userKey].name}
</span>
</bdo>,
') ',
<span className="color-text-secondary css-truncate">
(<bdo className="css-truncate-target" style={{maxWidth: '200px'}}>{name}</bdo>)
</span>,
);
}
}
Expand Down

0 comments on commit 58fa640

Please sign in to comment.