diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-15 13:34:05 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-15 14:12:24 -0500 |
commit | cf3ec71aa564c7fe47ec79f8dd5f14e3bce0b85c (patch) | |
tree | 49a3356c4177157b377aeca223a7d1c1e2e3dc17 /app/lib/activitypub | |
parent | 0a5eba734e6aa6a6e7e8f64b022af8ea129c9f5d (diff) |
local visibility scope, chat scope+tags, unlisted tags
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r-- | app/lib/activitypub/activity/create.rb | 14 | ||||
-rw-r--r-- | app/lib/activitypub/tag_manager.rb | 8 |
2 files changed, 16 insertions, 6 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) diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 595291342..baec9da21 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -62,9 +62,9 @@ class ActivityPub::TagManager case status.visibility when 'public' [COLLECTIONS[:public]] - when 'unlisted', 'private' + when 'unlisted', 'private', 'local' [account_followers_url(status.account)] - when 'direct', 'limited' + when 'direct', 'limited', 'chat' if status.account.silenced? # Only notify followers if the account is locally silenced account_ids = status.active_mentions.pluck(:account_id) @@ -89,11 +89,11 @@ class ActivityPub::TagManager case status.visibility when 'public' cc << account_followers_url(status.account) - when 'unlisted' + when 'unlisted', 'local' cc << COLLECTIONS[:public] end - unless status.direct_visibility? || status.limited_visibility? + unless status.direct_visibility? || status.limited_visibility? || status.chat_visibility? if status.account.silenced? # Only notify followers if the account is locally silenced account_ids = status.active_mentions.pluck(:account_id) |