Skip to content

Commit 5da4438

Browse files
committed
Fix: Do not display hidden verified accounts
1 parent 2e9405f commit 5da4438

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

web/packages/hovercards/src/core.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import computePosition from './compute-position';
33
import { escUrl, escHtml } from './sanitizer';
44
import __ from './i18n';
55

6-
type AccountData = Record< 'service_type' | 'service_label' | 'service_icon' | 'url', string >;
6+
type AccountData = Record< 'service_type' | 'service_label' | 'service_icon' | 'url' | 'is_hidden', string >;
77

8-
export type VerifiedAccount = Record< 'type' | 'label' | 'icon' | 'url', string >;
8+
export type VerifiedAccount = Record< 'type' | 'label' | 'icon' | 'url' | 'isHidden', string >;
99

1010
export interface ProfileData {
1111
hash: string;
@@ -248,7 +248,11 @@ export default class Hovercards {
248248
const isEditProfile = ! description && myHash === hash;
249249
const renderSocialLinks = verifiedAccounts
250250
.slice( 0, 3 )
251-
.reduce( ( links, { label, icon, url, type } ) => {
251+
.reduce( ( links, { label, icon, url, type, isHidden } ) => {
252+
if ( isHidden ) {
253+
return links;
254+
}
255+
252256
links.push( `
253257
<a class="gravatar-hovercard__social-link" href="${ escUrl( url ) }" target="_blank" data-service-name="${ type }">
254258
<img class="gravatar-hovercard__social-icon" src="${ escUrl( icon ) }" width="32" height="32" alt="${ escHtml(
@@ -419,6 +423,7 @@ export default class Hovercards {
419423
label: account.service_label,
420424
icon: account.service_icon,
421425
url: account.url,
426+
isHidden: account.is_hidden,
422427
} ) ),
423428
} );
424429

0 commit comments

Comments
 (0)