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({ export default Component.extend({
tagName: null, tagName: null,
link: null, href: null,
label: 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") @discourseComputed("topic", "topicTrackingState.messageCount")
browseMoreMessage(topic) { browseMoreMessage(topic) {
// TODO decide what to show for pms // TODO decide what to show for pms

View File

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

View File

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

View File

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

View File

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

View File

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