Skip to content

Commit 05eeb6f

Browse files
authored
Merge pull request mastodon#116 from CrossGate-Pawoo/group
Use Status.group instead of Status.distinct in HashQueryService
2 parents 6e38702 + 8c29679 commit 05eeb6f

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

app/controllers/api/v1/timelines/tag_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ def tagged_statuses
3535
)
3636

3737
if truthy_param?(:only_media)
38-
# `SELECT DISTINCT id, updated_at` is too slow, so pluck ids at first, and then select id, updated_at with ids.
39-
status_ids = statuses.joins(:media_attachments).distinct(:id).pluck(:id)
40-
statuses.where(id: status_ids)
38+
statuses.joins(:media_attachments)
4139
else
4240
statuses
4341
end

app/services/hashtag_query_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def call(tag, params, account = nil, local = false)
66
all = tags_for(params[:all])
77
none = tags_for(params[:none])
88

9-
Status.distinct
9+
Status.group(:id)
1010
.as_tag_timeline(tags, account, local)
1111
.tagged_with_all(all)
1212
.tagged_with_none(none)

0 commit comments

Comments
 (0)