Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 4b12ace

Browse files
committed
clean
1 parent b360747 commit 4b12ace

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

assets/javascripts/discourse/components/admin-report-emotion.hbs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<div class="cell value today-count">
99
<a
10-
href="{{this.filterURL}}activity-after%3A{{this.today}}%20order%3A{{this.model.type}}"
10+
href="{{this.todayLink}}"
1111
>
1212
{{number this.model.todayCount}}
1313
</a>
@@ -18,7 +18,7 @@
1818
title={{this.model.yesterdayCountTitle}}
1919
>
2020
<a
21-
href="{{this.filterURL}}activity-after%3A{{this.yesterday}}%20order%3A{{this.model.type}}"
21+
href="{{this.yesterdayLink}}"
2222
>
2323
{{number this.model.yesterdayCount}}
2424
</a>
@@ -30,7 +30,7 @@
3030
title={{this.model.sevenDaysCountTitle}}
3131
>
3232
<a
33-
href="{{this.filterURL}}activity-after%3A{{this.lastWeek}}%20order%3A{{this.model.type}}"
33+
href="{{this.lastSevenDaysLink}}"
3434
>
3535
{{number this.model.lastSevenDaysCount}}
3636
</a>
@@ -43,11 +43,11 @@
4343
>
4444

4545
<a
46-
href="{{this.filterURL}}activity-after%3A{{this.lastMonth}}%20order%3A{{this.model.type}}"
46+
href="{{this.lastThirtyDaysLink}}"
4747
>
4848
{{number this.model.lastThirtyDaysCount}}
4949
</a>
5050
{{#if this.model.canDisplayTrendIcon}}
5151
{{d-icon this.model.thirtyDaysTrendIcon}}
5252
{{/if}}
53-
</div>
53+
</div>

assets/javascripts/discourse/components/admin-report-emotion.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,35 @@ import getURL from "discourse-common/lib/get-url";
55
@classNames("admin-report-counters")
66
@attributeBindings("model.description:title")
77
export default class AdminReportEmotion extends Component {
8-
get filterURL() {
9-
return getURL(`/filter?q=`);
8+
get todayLink() {
9+
let date = moment().format("YYYY-MM-DD");
10+
return this._filterURL(date);
1011
}
1112

12-
get today() {
13-
return moment().format("YYYY-MM-DD");
13+
get yesterdayLink() {
14+
let date = moment().subtract(1, "day").format("YYYY-MM-DD");
15+
return this._filterURL(date);
1416
}
1517

16-
get yesterday() {
17-
return moment().subtract(1, "day").format("YYYY-MM-DD");
18+
get lastSevenDaysLink() {
19+
let date = moment().subtract(1, "week").format("YYYY-MM-DD");
20+
return this._filterURL(date);
1821
}
1922

20-
get lastWeek() {
21-
return moment().subtract(1, "week").format("YYYY-MM-DD");
23+
get lastThirtyDaysLink() {
24+
let date = moment().subtract(1, "month").format("YYYY-MM-DD");
25+
return this._filterURL(date);
2226
}
2327

24-
get lastMonth() {
25-
return moment().subtract(1, "month").format("YYYY-MM-DD");
28+
_baseFilter() {
29+
return "/filter?q=activity-after%3A";
30+
}
31+
32+
_model() {
33+
return "%20order%3A" + this.model.type;
34+
}
35+
36+
_filterURL(date) {
37+
return getURL(`${this._baseFilter()}${date}${this._model()}`);
2638
}
2739
}

assets/javascripts/discourse/controllers/admin-dashboard-sentiment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class AdminDashboardSentiment extends AdminDashboardTabController
99

1010
get emotionFilters() {
1111
return {
12-
startDate: moment().subtract(2, "month").format("YYYY-MM-DD"),
12+
startDate: moment().subtract(2, "year").format("YYYY-MM-DD"),
1313
endDate: moment().format("YYYY-MM-DD"),
1414
};
1515
}

spec/system/admin_dashboard_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,14 @@
1212

1313
expect(page).to have_css(".section.sentiment")
1414
end
15+
16+
xit "displays the emotion table with links" do
17+
SiteSetting.ai_sentiment_enabled = true
18+
sign_in(admin)
19+
20+
visit "/admin"
21+
find(".navigation-item.sentiment").click()
22+
23+
expect(page).to have_css(".admin-report.emotion-love .cell.value.today-count a")
24+
end
1525
end

0 commit comments

Comments
 (0)