Add featured hashtags to profiles (#9755)
* Add hashtag filter to profiles GET /@:username/tagged/:hashtag GET /api/v1/accounts/:id/statuses?tagged=:hashtag * Display featured hashtags on public profile * Use separate model for featured tags * Update featured hashtag counters on-write * Limit featured tags to 10
This commit is contained in:
parent
d14c276e58
commit
364f2ff9aa
24 changed files with 238 additions and 8 deletions
|
@ -33,6 +33,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
|
|||
statuses.merge!(only_media_scope) if truthy_param?(:only_media)
|
||||
statuses.merge!(no_replies_scope) if truthy_param?(:exclude_replies)
|
||||
statuses.merge!(no_reblogs_scope) if truthy_param?(:exclude_reblogs)
|
||||
statuses.merge!(hashtag_scope) if params[:tagged].present?
|
||||
|
||||
statuses
|
||||
end
|
||||
|
@ -67,6 +68,10 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
|
|||
Status.without_reblogs
|
||||
end
|
||||
|
||||
def hashtag_scope
|
||||
Status.tagged_with(Tag.find_by(name: params[:tagged])&.id)
|
||||
end
|
||||
|
||||
def pagination_params(core_params)
|
||||
params.slice(:limit, :only_media, :exclude_replies).permit(:limit, :only_media, :exclude_replies).merge(core_params)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue