Skip to content

Commit 6325777

Browse files
UX: Rewind feedback and fixes 2 (#36614)
* Add missing translation string * Refactor is_rewind_active into the JS service, and undo change to plugin.rb looking at whether rewind is disabled * Replace emoji in best topic titles
1 parent 791e95d commit 6325777

File tree

10 files changed

+27
-23
lines changed

10 files changed

+27
-23
lines changed

plugins/discourse-rewind/app/services/discourse_rewind/action/best_topics.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class BestTopics < BaseReport
1313
},
1414
{
1515
topic_id: 2,
16-
title: "Best practices for database optimization",
16+
title: ":file_cabinet: Best practices for database optimization",
1717
excerpt: "Learn how to optimize your database queries for better performance...",
1818
yearly_score: 38.2,
1919
},

plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export default class BestTopics extends Component {
2828
>
2929
<span class="best-topics --rank"></span>
3030
<span class="best-topics --rank"></span>
31-
<h2 class="best-topics__header">{{topic.title}}</h2>
31+
<h2 class="best-topics__header">{{replaceEmoji
32+
topic.title
33+
}}</h2>
3234
<span class="best-topics__excerpt">
3335
{{replaceEmoji (htmlSafe topic.excerpt)}}
3436
</span>

plugins/discourse-rewind/assets/javascripts/discourse/components/reports/new-user-interactions.gjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export default class NewUserInteractions extends Component {
1414
<template>
1515
<div class="rewind-report-page --new-user-interactions">
1616
<div class="wordart-container">
17-
<div class="wordart-text">your contributions helped</div>
17+
<div class="wordart-text">
18+
{{i18n
19+
"discourse_rewind.reports.new_user_interactions.your_contributions_helped"
20+
}}
21+
</div>
1822
<div class="wordart-3d">
1923
{{#each this.wavyWords as |word|}}
2024
<span class="wordart-word">

plugins/discourse-rewind/assets/javascripts/discourse/connectors/after-header-panel/rewind-decoration.gjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import { service } from "@ember/service";
33
import bodyClass from "discourse/helpers/body-class";
44

55
export default class AvatarDecorator extends Component {
6-
@service currentUser;
76
@service rewind;
87

98
get showDecorator() {
109
return (
11-
this.currentUser?.is_rewind_active &&
12-
!this.rewind.dismissed &&
13-
!this.rewind.disabled
10+
this.rewind.active && !this.rewind.dismissed && !this.rewind.disabled
1411
);
1512
}
1613

plugins/discourse-rewind/assets/javascripts/discourse/connectors/before-panel-body/rewind-callout.gjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ import { i18n } from "discourse-i18n";
77

88
export default class RewindCallout extends Component {
99
@service router;
10-
@service currentUser;
1110
@service rewind;
1211

1312
get showCallout() {
1413
return (
15-
this.currentUser?.is_rewind_active &&
16-
!this.rewind.dismissed &&
17-
!this.rewind.disabled
14+
this.rewind.active && !this.rewind.dismissed && !this.rewind.disabled
1815
);
1916
}
2017

plugins/discourse-rewind/assets/javascripts/discourse/connectors/user-activity-bottom/rewind-tab.gjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import icon from "discourse/helpers/d-icon";
55
import { i18n } from "discourse-i18n";
66

77
export default class RewindTab extends Component {
8-
@service currentUser;
98
@service rewind;
109

1110
get showNavTab() {
12-
return this.currentUser?.is_rewind_active && !this.rewind.disabled;
11+
return this.rewind.active && !this.rewind.disabled;
1312
}
1413

1514
<template>

plugins/discourse-rewind/assets/javascripts/discourse/initializers/rewind-setup.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@ export default {
1313
return;
1414
}
1515

16-
if (!this.currentUser.is_rewind_active) {
16+
if (!this.rewind.active) {
1717
return;
1818
}
1919

2020
withPluginApi((api) => {
21-
api.addQuickAccessProfileItem({
22-
icon: "repeat",
23-
href: "/my/activity/rewind",
24-
content: i18n("discourse_rewind.profile_link", {
25-
rewindYear: this.rewind.fetchRewindYear,
26-
}),
27-
});
21+
if (!this.rewind.disabled) {
22+
api.addQuickAccessProfileItem({
23+
icon: "repeat",
24+
href: "/my/activity/rewind",
25+
content: i18n("discourse_rewind.profile_link", {
26+
rewindYear: this.rewind.fetchRewindYear,
27+
}),
28+
});
29+
}
2830
});
2931
},
3032
};

plugins/discourse-rewind/assets/javascripts/discourse/services/rewind.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export default class Rewind extends Service {
1212
@tracked
1313
_isDisabled = this.currentUser?.user_option?.discourse_rewind_disabled;
1414

15+
get active() {
16+
return this.currentUser?.is_rewind_active;
17+
}
18+
1519
get disabled() {
1620
return this._isDisabled ?? false;
1721
}

plugins/discourse-rewind/config/locales/client.en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ en:
133133
replies: Replies to Posts
134134
mentions: Mentions
135135
topics_with_new_users: Topics with New Users
136+
your_contributions_helped: your contributions helped
136137
time_of_day_activity:
137138
title: Daily Activity Rhythm
138139
play_button: Play your activity as sound

plugins/discourse-rewind/plugin.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ def self.year_date_range(date_override = nil)
6565
end
6666

6767
add_to_serializer(:current_user, :is_rewind_active) do
68-
return false if object.user_option&.discourse_rewind_disabled
69-
7068
Rails.env.development? || Date.today.month == 1 || Date.today.month == 12
7169
end
7270

0 commit comments

Comments
 (0)