REFACTOR: removes places where we never show glyph and DRY code (#8744)

This commit is contained in:
Joffrey JAFFEUX 2020-01-17 20:58:15 +01:00 committed by GitHub
parent cb54bf4f45
commit a7ae28ed88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 37 deletions

View File

@ -2,6 +2,7 @@ import Component from "@ember/component";
export default Component.extend({
tagName: null,
link: null,
label: null
href: null,
title: null,
ariaLabel: null
});

View File

@ -17,10 +17,6 @@ export default Component.extend({
}
}),
suggestedTitleLink: computed("topic", function() {
return this.currentUser && this.currentUser.pmPath(this.topic);
}),
@discourseComputed("topic", "topicTrackingState.messageCount")
browseMoreMessage(topic) {
// TODO decide what to show for pms

View File

@ -1,16 +1,11 @@
{{#if link}}
<a href={{link}} aria-label={{i18n "user.messages.inbox"}} class="private-message-glyph-wrapper">
{{d-icon "envelope" class="private-message-glyph"}}
</a>
{{#if label}}
<span>{{i18n label}}</span>
{{/if}}
{{else}}
{{#if label}}
<span>{{i18n label}}</span>
{{else}}
{{#if href}}
<a href={{href}} title={{i18n title}} aria-label={{i18n ariaLabel}}>
<span class="private-message-glyph-wrapper">
{{d-icon "envelope" class="private-message-glyph"}}
</span>
{{/if}}
</a>
{{else}}
<span class="private-message-glyph-wrapper">
{{d-icon "envelope" class="private-message-glyph"}}
</span>
{{/if}}

View File

@ -1,8 +1,5 @@
<h3 class="suggested-topics-title">
{{private-message-glyph
link=relatedTitleLink
label="related_messages.title"
}}
{{i18n "related_messages.title"}}
</h3>
<div class="topics">

View File

@ -1,8 +1,5 @@
<h3 class="suggested-topics-title">
{{private-message-glyph
link=suggestedTitleLink
label=suggestedTitleLabel
}}
{{i18n suggestedTitleLabel}}
</h3>
<div class="topics">

View File

@ -18,6 +18,7 @@
{{#if editingTopic}}
<div class="edit-topic-title">
{{private-message-glyph isVisible=model.isPrivateMessage}}
{{text-field id="edit-title" value=buffered.title maxlength=siteSettings.max_topic_title_length autofocus="true"}}
{{#if showCategoryChooser}}
@ -54,15 +55,14 @@
<h1 data-topic-id="{{unbound model.id}}">
{{#unless model.is_warning}}
{{#if siteSettings.enable_personal_messages}}
{{#if model.isPrivateMessage}}
<a href={{pmPath}} title="{{i18n 'topic_statuses.personal_message.title'}}" aria-label={{i18n 'user.messages.inbox'}}>
<span class="private-message-glyph">{{d-icon "envelope"}}</span>
</a>
{{/if}}
{{private-message-glyph
isVisible=model.isPrivateMessage
href=pmPath
title="topic_statuses.personal_message.title"
ariaLabel="user.messages.inbox"
}}
{{else}}
{{#if model.isPrivateMessage}}
<span class="private-message-glyph">{{d-icon "envelope"}}</span>
{{/if}}
{{private-message-glyph isVisible=model.isPrivateMessage}}
{{/if}}
{{/unless}}

View File

@ -216,9 +216,6 @@ a.badge-category {
.suggested-topics .suggested-topics-title {
display: flex;
align-items: center;
.private-message-glyph {
display: none;
}
}
.post-links-container {