about summary refs log tree commit diff
path: root/app/lib/activitypub/activity/create.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/activitypub/activity/create.rb')
-rw-r--r--app/lib/activitypub/activity/create.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 263dbbb87..2b267c0d7 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -153,7 +153,9 @@ 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.distributable?
+      tag.chatters.find_or_create_by(account_id: status.account) if tag.chat?
+      next unless status.distributable? && !tag.chat?
+      TrendingTags.record_use!(tag, status.account, status.created_at)
     end
 
     @mentions.each do |mention|
@@ -181,7 +183,15 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
 
     hashtag = tag['name'].gsub(/\A#/, '').gsub(':', '.').mb_chars.downcase
 
-    return if !@options[:imported] && hashtag.starts_with?('self.', '_self.', 'local.', '_local.')
+    return if !@options[:imported] && (
+      hashtag.in?(%w(self .self local .local chat.local .chat.local)) ||
+      hashtag.starts_with?('self.', '.self', 'local.', '.local', 'chat.local.', '.chat.local.')
+    )
+
+    if tag['name'].starts_with?('chat.', '.chat.')
+      @params[:visibility] = :chat
+      @params[:thread] = nil
+    end
 
     hashtag = Tag.where(name: hashtag).first_or_create!(name: hashtag)