diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2021-05-07 14:33:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 14:33:43 +0200 |
commit | 74081433d0078784b7c2139f6caaa812740632b2 (patch) | |
tree | 02af62ad9e8dad4d2b9d7c504c7ffce27cdf26ac /app/services | |
parent | 2c77d97e0d59e045a9b04fccc83f0f24d190d8d8 (diff) |
Change trending hashtags to be affected be reblogs (#16164)
If a status with a hashtag becomes very popular, it stands to reason that the hashtag should have a chance at trending Fix no stats being recorded for hashtags that are not allowed to trend, and stop ignoring bots Remove references to hashtags in profile directory from the code and the admin UI
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/process_hashtags_service.rb | 3 | ||||
-rw-r--r-- | app/services/reblog_service.rb | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/app/services/process_hashtags_service.rb b/app/services/process_hashtags_service.rb index e8e139b05..c42b79db8 100644 --- a/app/services/process_hashtags_service.rb +++ b/app/services/process_hashtags_service.rb @@ -8,8 +8,7 @@ class ProcessHashtagsService < BaseService Tag.find_or_create_by_names(tags) do |tag| status.tags << tag records << tag - - TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility? + tag.use!(status.account, status: status, at_time: status.created_at) if status.public_visibility? end return unless status.distributable? diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index 5032397b3..744bdf567 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -35,6 +35,7 @@ class ReblogService < BaseService create_notification(reblog) bump_potential_friendship(account, reblog) + record_use(account, reblog) reblog end @@ -59,6 +60,16 @@ class ReblogService < BaseService PotentialFriendshipTracker.record(account.id, reblog.reblog.account_id, :reblog) end + def record_use(account, reblog) + return unless reblog.public_visibility? + + original_status = reblog.reblog + + original_status.tags.each do |tag| + tag.use!(account) + end + end + def build_json(reblog) Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog), ActivityPub::ActivitySerializer, signer: reblog.account)) end |