From a47b1daaebea09ca07ca93079e530f26cfeef914 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sun, 5 May 2019 23:04:23 -0500 Subject: Implement scoped tags; use `local:` and `self:` scopes for community and personal tags, respectively. --- app/lib/activitypub/activity/create.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/lib/activitypub') 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) -- cgit