Skip to content

Commit 824d4a4

Browse files
committed
Restrict tags and categories to user visibility level
1 parent 6a7efb7 commit 824d4a4

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Diff for: app/services/discourse_rewind/action/favorite_categories.rb

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def call
2323
.joins("INNER JOIN categories ON categories.id = topics.category_id")
2424
.where(user: user)
2525
.where(viewed_at: date)
26+
.where(categories: { id: user.guardian.allowed_category_ids })
2627
.group("categories.id, categories.name")
2728
.order("COUNT(*) DESC")
2829
.limit(5)

Diff for: app/services/discourse_rewind/action/favorite_tags.rb

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def call
2525
.joins("INNER JOIN tags ON tags.id = topic_tags.tag_id")
2626
.where(user: user)
2727
.where(viewed_at: date)
28+
.where(tags: { id: Tag.visible(user.guardian).pluck(:id) })
2829
.group("tags.id, tags.name")
2930
.order("COUNT(DISTINCT topic_views.topic_id) DESC")
3031
.limit(5)

Diff for: app/services/discourse_rewind/fetch_reports.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FetchReports
2626
Action::ReadingTime,
2727
Action::Reactions,
2828
Action::Fbff,
29-
# Action::FavoriteTags,
29+
Action::FavoriteTags,
3030
Action::FavoriteCategories,
3131
Action::BestTopics,
3232
Action::BestPosts,

0 commit comments

Comments
 (0)