Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

templates: Simplify the rendering of default external account icons.

Niloth P76596b72a0d2
diff --git a/web/templates/default_external_account_icon.hbs b/web/templates/default_external_account_icon.hbs
new file mode 100644
index 00000000000..d52848b6d73
--- /dev/null
+++ b/web/templates/default_external_account_icon.hbs
@@ -0,0 +1,3 @@
+{{#unless (eq this.subtype "custom")}}
+ <i class="fa fa-{{this.subtype}}" aria-hidden="true"></i>
+{{/unless}}
diff --git a/web/templates/popovers/user_card/user_card_popover_custom_fields.hbs b/web/templates/popovers/user_card/user_card_popover_custom_fields.hbs
index b26d539c120..31c6e113b64 100644
--- a/web/templates/popovers/user_card/user_card_popover_custom_fields.hbs
+++ b/web/templates/popovers/user_card/user_card_popover_custom_fields.hbs
@@ -9,11 +9,7 @@
</span>
{{else if this.is_external_account}}
<a href="{{this.link}}" target="_blank" rel="noopener noreferrer" class="custom-profile-field-value custom-profile-field-link" data-tippy-content="{{this.name}}" tabindex="0">
- {{#if (eq this.subtype "github") }}
- <i class="popover-menu-icon fa fa-github" aria-hidden="true"></i>
- {{else if (eq this.subtype "twitter") }}
- <i class="popover-menu-icon fa fa-twitter" aria-hidden="true"></i>
- {{/if}}
+ {{> ../../default_external_account_icon subtype=this.subtype}}
<span class="custom-profile-field-text">{{this.value}}</span>
</a>
{{else if this.rendered_value}}
diff --git a/web/templates/user_custom_profile_fields.hbs b/web/templates/user_custom_profile_fields.hbs
index e9c29413c35..73283c816a7 100644
--- a/web/templates/user_custom_profile_fields.hbs
+++ b/web/templates/user_custom_profile_fields.hbs
@@ -12,11 +12,7 @@
</div>
{{else if this.is_external_account}}
<a tabindex="0" href="{{this.link}}" target="_blank" rel="noopener noreferrer" class="value custom-profile-fields-link {{#if ../for_user_card_popover}}tippy-zulip-tooltip{{/if}}" data-tippy-content="{{this.name}}">
- {{#if (eq this.subtype "github") }}
- <i class="fa fa-github" aria-hidden="true"></i>
- {{else if (eq this.subtype "twitter") }}
- <i class="fa fa-twitter" aria-hidden="true"></i>
- {{/if}}
+ {{> default_external_account_icon subtype=this.subtype}}
{{this.value}}
</a>
{{else if this.is_user_field}}