DEV: Remove dead code (`latestTopicOnly`) (#11833)
Background: I wanted to see `categories.latest_by` translation in context in a live app but couldn't find it, so I traced it throughout the code.
My step-by-step reasoning for the removal is:
1. `categories-only` does not use `latestTopicOnly`, so there's no need to call it with that argument
2. `parent-category-row` is never called with `latestTopicOnly` argument, so the reference to that arg can be removed from its template
3. after that, `featured-topic` is now no longer ever called with `latestTopicOnly` argument (except in the `ghost` theme, but that's because its override of `categories-only` template 4e2fba963c/common/header.html (L119)
is based on the old version of that template from core), so it seems safe to remove it there too (`categories.latest_by` i18n string is also no longer needed)
4. then, nothing is using `latestTopicOnly` anymore so it can be removed from `categories` hbs/js
I checked in each step that there are no plugins or themes (in all-the-plugins/all-the-themes) using those properties/arguments/strings.
This commit is contained in:
parent
5a6baa7c46
commit
8881ae4af4
|
@ -19,15 +19,6 @@ export default DiscoveryController.extend({
|
|||
|
||||
canEdit: reads("currentUser.staff"),
|
||||
|
||||
@discourseComputed("model.categories.[].featuredTopics.length")
|
||||
latestTopicOnly() {
|
||||
return (
|
||||
this.get("model.categories").find(
|
||||
(c) => c.get("featuredTopics.length") > 1
|
||||
) === undefined
|
||||
);
|
||||
},
|
||||
|
||||
@discourseComputed("model.parentCategory")
|
||||
categoryPageStyle(parentCategory) {
|
||||
let style = this.site.mobileView
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
{{categories-only categories=categories
|
||||
latestTopicOnly=latestTopicOnly
|
||||
showTopics="true"}}
|
||||
|
|
|
@ -2,11 +2,4 @@
|
|||
<a href={{topic.lastUnreadUrl}} class="title">{{html-safe topic.fancyTitle}}</a>
|
||||
{{topic-post-badges newPosts=topic.totalUnread unseen=topic.unseen url=topic.lastUnreadUrl}}
|
||||
|
||||
{{#if latestTopicOnly}}
|
||||
<div class="last-user-info">
|
||||
{{i18n "categories.latest_by"}} <a href={{html-safe topic.lastPosterUrl}}>{{topic.last_poster.username}}</a>
|
||||
<a href={{topic.lastPostUrl}}>{{format-age topic.last_posted_at}}</a>
|
||||
</div>
|
||||
{{else}}
|
||||
<a href={{topic.lastPostUrl}} class="last-posted-at">{{format-age topic.last_posted_at}}</a>
|
||||
{{/if}}
|
||||
<a href={{topic.lastPostUrl}} class="last-posted-at">{{format-age topic.last_posted_at}}</a>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
{{#if showTopics}}
|
||||
<td class="latest">
|
||||
{{#each category.featuredTopics as |t|}}
|
||||
{{featured-topic topic=t latestTopicOnly=latestTopicOnly}}
|
||||
{{featured-topic topic=t}}
|
||||
{{/each}}
|
||||
</td>
|
||||
{{/if}}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{{#discovery-categories refresh=(action "refresh")}}
|
||||
{{component categoryPageStyle
|
||||
categories=model.categories
|
||||
latestTopicOnly=latestTopicOnly
|
||||
topics=model.topics}}
|
||||
{{/discovery-categories}}
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
{{categories-only categories=categories
|
||||
latestTopicOnly=latestTopicOnly
|
||||
showTopics="true"}}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{{#discovery-categories refresh=(action "refresh")}}
|
||||
{{component categoryPageStyle
|
||||
categories=model.categories
|
||||
latestTopicOnly=latestTopicOnly
|
||||
topics=model.topics}}
|
||||
{{/discovery-categories}}
|
||||
|
|
|
@ -838,7 +838,6 @@ en:
|
|||
posts: "Posts"
|
||||
topics: "Topics"
|
||||
latest: "Latest"
|
||||
latest_by: "latest by"
|
||||
toggle_ordering: "toggle ordering control"
|
||||
subcategories: "Subcategories"
|
||||
muted: "Muted categories"
|
||||
|
|
Loading…
Reference in New Issue