diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-05-05 23:04:23 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:22 -0500 |
commit | a47b1daaebea09ca07ca93079e530f26cfeef914 (patch) | |
tree | 04f08b28710732d1a9747c64537cd75162a651ca /app/lib | |
parent | 992218f05f76106857f2cb5a72c0bb4510aa4563 (diff) |
Implement scoped tags; use `local:` and `self:` scopes for community and personal tags, respectively.
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activitypub/activity/create.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 62b8986a4..d52ec0e86 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -121,7 +121,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity def attach_tags(status) @tags.each do |tag| status.tags << tag - TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility? + TrendingTags.record_use!(tag, status.account, status.created_at) if status.distributable? end @mentions.each do |mention| @@ -148,6 +148,9 @@ class ActivityPub::Activity::Create < ActivityPub::Activity return if tag['name'].blank? hashtag = tag['name'].gsub(/\A#/, '').mb_chars.downcase + + return if hashtag.starts_with?('self:', '_self:', 'local:', '_local:') + hashtag = Tag.where(name: hashtag).first_or_create!(name: hashtag) return if @tags.include?(hashtag) |