about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/helpers/stream_entries_helper.rb2
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js8
-rw-r--r--app/lib/activitypub/activity/create.rb13
-rw-r--r--app/lib/activitypub/adapter.rb4
-rw-r--r--app/lib/activitypub/tag_manager.rb11
-rw-r--r--app/models/account.rb10
-rw-r--r--app/models/chat_account.rb17
-rw-r--r--app/models/status.rb9
-rw-r--r--app/models/tag.rb9
-rw-r--r--app/serializers/activitypub/actor_serializer.rb4
-rw-r--r--app/serializers/rest/account_serializer.rb2
-rw-r--r--app/serializers/rest/status_serializer.rb2
-rw-r--r--app/services/activitypub/process_account_service.rb1
-rw-r--r--app/services/fan_out_on_write_service.rb5
-rw-r--r--app/services/post_status_service.rb25
-rw-r--r--app/services/process_hashtags_service.rb11
-rw-r--r--app/views/settings/profiles/show.html.haml1
-rw-r--r--app/workers/activitypub/distribute_poll_update_worker.rb2
-rw-r--r--app/workers/activitypub/distribution_worker.rb2
19 files changed, 26 insertions, 112 deletions
diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb
index fcf98fd70..99df8e913 100644
--- a/app/helpers/stream_entries_helper.rb
+++ b/app/helpers/stream_entries_helper.rb
@@ -207,8 +207,6 @@ module StreamEntriesHelper
       fa_icon 'unlock fw'
     when 'local'
       fa_icon 'users fw'
-    when 'chat'
-      fa_icon 'paper-plane fw'
     when 'private'
       fa_icon 'lock fw'
     when 'direct'
diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js
index 8747d51f5..43876e450 100644
--- a/app/javascript/flavours/glitch/reducers/compose.js
+++ b/app/javascript/flavours/glitch/reducers/compose.js
@@ -116,10 +116,6 @@ function statusToTextMentions(state, status) {
     set = set.add(`@${status.getIn(['account', 'acct'])} `);
   }
 
-  set = set.union(status.get('tags').filter(
-    tag => tag.get('name') && tag.get('name').startsWith("chat.")
-  ).map(tag => `#${tag.get('name')} `));
-
   return set.union(status.get('mentions').filterNot(mention => mention.get('id') === me).map(mention => `@${mention.get('acct')} `)).join('');
 };
 
@@ -130,10 +126,6 @@ function apiStatusToTextMentions (state, status) {
     set = set.add(`@${status.account.acct} `);
   }
 
-  set = set.union(status.tags.filter(
-    tag => tag.name && tag.name.startsWith("chat.")
-  ).map(tag => `#${tag.name} `));
-
   return set.union(status.mentions.filter(
     mention => mention.id !== me
   ).map(
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 94cde4bd6..1c20d3844 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -159,9 +159,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
   def attach_tags(status)
     @tags.each do |tag|
       status.tags << tag
-      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)
+      TrendingTags.record_use!(tag, status.account, status.created_at) if status.distributable?
     end
 
     @mentions.each do |mention|
@@ -190,15 +188,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
     hashtag = tag['name'].gsub(/\A#/, '').gsub(':', '.').mb_chars.downcase
 
     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.')
+      hashtag.in?(%w(self .self local .local)) ||
+      hashtag.starts_with?('self.', '.self', 'local.', '.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)
 
     return if @tags.include?(hashtag)
diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb
index 21a2c167b..e3a6c57eb 100644
--- a/app/lib/activitypub/adapter.rb
+++ b/app/lib/activitypub/adapter.rb
@@ -32,10 +32,6 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
       'mp' => 'https://monsterpit.net/ns#',
       'kobold' => 'mp:kobold'
     },
-    supports_chat: {
-      'mp' => 'https://monsterpit.net/ns#',
-      'supportsChat' => 'mp:supportsChat'
-    },
     froze: {
       'mp' => 'https://monsterpit.net/ns#',
       'froze' => 'mp:froze'
diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb
index baec9da21..22e26d116 100644
--- a/app/lib/activitypub/tag_manager.rb
+++ b/app/lib/activitypub/tag_manager.rb
@@ -17,7 +17,7 @@ class ActivityPub::TagManager
 
     case target.object_type
     when :person
-      short_account_url(target)
+      target.instance_actor? ? about_more_url(instance_actor: true) : short_account_url(target)
     when :note, :comment, :activity
       return activity_account_status_url(target.account, target) if target.reblog?
       short_account_status_url(target.account, target)
@@ -29,7 +29,7 @@ class ActivityPub::TagManager
 
     case target.object_type
     when :person
-      account_url(target)
+      target.instance_actor? ? instance_actor_url : account_url(target)
     when :note, :comment, :activity
       return activity_account_status_url(target.account, target) if target.reblog?
       account_status_url(target.account, target)
@@ -51,7 +51,7 @@ class ActivityPub::TagManager
   def replies_uri_for(target, page_params = nil)
     raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
 
-    replies_account_status_url(target.account, target, page_params)
+    account_status_replies_url(target.account, target, page_params)
   end
 
   # Primary audience of a status
@@ -64,7 +64,7 @@ class ActivityPub::TagManager
       [COLLECTIONS[:public]]
     when 'unlisted', 'private', 'local'
       [account_followers_url(status.account)]
-    when 'direct', 'limited', 'chat'
+    when 'direct', 'limited'
       if status.account.silenced?
         # Only notify followers if the account is locally silenced
         account_ids = status.active_mentions.pluck(:account_id)
@@ -93,7 +93,7 @@ class ActivityPub::TagManager
       cc << COLLECTIONS[:public]
     end
 
-    unless status.direct_visibility? || status.limited_visibility? || status.chat_visibility?
+    unless status.direct_visibility? || status.limited_visibility?
       if status.account.silenced?
         # Only notify followers if the account is locally silenced
         account_ids = status.active_mentions.pluck(:account_id)
@@ -119,6 +119,7 @@ class ActivityPub::TagManager
 
   def uri_to_local_id(uri, param = :id)
     path_params = Rails.application.routes.recognize_path(uri)
+    path_params[:username] = Rails.configuration.x.local_domain if path_params[:controller] == 'instance_actors'
     path_params[param]
   end
 
diff --git a/app/models/account.rb b/app/models/account.rb
index 068b5e7a0..efa6b8fbd 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -48,7 +48,6 @@
 #  adult_content           :boolean          default(FALSE), not null
 #  silenced_at             :datetime
 #  suspended_at            :datetime
-#  supports_chat           :boolean          default(FALSE), not null
 #  gently                  :boolean          default(FALSE), not null
 #  kobold                  :boolean          default(FALSE), not null
 #  froze                   :boolean
@@ -75,9 +74,6 @@ class Account < ApplicationRecord
 
   LOCAL_DOMAINS = ENV.fetch('LOCAL_DOMAINS', '').chomp.split(/\.?\s+/).freeze
 
-  has_many :chat_accounts, dependent: :destroy, inverse_of: :account
-  has_many :chat_tags, through: :chat_accounts, source: :tag
-
   validates :username, presence: true
 
   # Remote user validations
@@ -559,7 +555,6 @@ class Account < ApplicationRecord
 
   before_create :generate_keys
   before_create :set_domain_from_inbox_url
-  before_create :set_chat_support
   before_validation :prepare_contents, if: :local?
   before_validation :prepare_username, on: :create
   before_destroy :clean_feed_manager
@@ -582,11 +577,6 @@ class Account < ApplicationRecord
     nil
   end
 
-  def set_chat_support
-    return unless local?
-    self.supports_chat = true
-  end
-
   def generate_keys
     return unless local? && !Rails.env.test?
 
diff --git a/app/models/chat_account.rb b/app/models/chat_account.rb
deleted file mode 100644
index 41589a395..000000000
--- a/app/models/chat_account.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# == Schema Information
-#
-# Table name: chat_accounts
-#
-#  id         :bigint(8)        not null, primary key
-#  account_id :bigint(8)        not null
-#  tag_id     :bigint(8)        not null
-#  created_at :datetime         not null
-#  updated_at :datetime         not null
-#
-
-class ChatAccount < ApplicationRecord
-  belongs_to :account, inverse_of: :chat_accounts
-  belongs_to :tag, inverse_of: :chat_accounts
-
-  validates :account_id, uniqueness: { scope: :tag_id }
-end
diff --git a/app/models/status.rb b/app/models/status.rb
index 946958758..a8c53d930 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -52,7 +52,7 @@ class Status < ApplicationRecord
 
   update_index('statuses#status', :proper) if Chewy.enabled?
 
-  enum visibility: [:public, :unlisted, :private, :direct, :limited, :local, :chat], _suffix: :visibility
+  enum visibility: [:public, :unlisted, :private, :direct, :limited, :local], _suffix: :visibility
 
   belongs_to :application, class_name: 'Doorkeeper::Application', optional: true
 
@@ -104,7 +104,7 @@ class Status < ApplicationRecord
   scope :reblogs, -> { where('statuses.reblog_of_id IS NOT NULL') } # all reblogs
   scope :with_public_visibility, -> { where(visibility: :public) }
   scope :public_local_visibility, -> { where(visibility: [:public, :local]) }
-  scope :public_browsable, -> { where(visibility: [:public, :unlisted, :local, :chat]) }
+  scope :public_browsable, -> { where(visibility: [:public, :unlisted, :local]) }
   scope :tagged_with, ->(tag) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag }) }
   scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) }
   scope :including_silenced_accounts, -> { left_outer_joins(:account).where.not(accounts: { silenced_at: nil }) }
@@ -262,11 +262,6 @@ class Status < ApplicationRecord
     @emojis = CustomEmoji.from_text(fields.join(' '), account.domain)
   end
 
-  def chat_tags
-    return @chat_tags if defined?(@chat_tags)
-    @chat_tags = tags.only_chat
-  end
-
   def delete_after
     destructing_status&.delete_after
   end
diff --git a/app/models/tag.rb b/app/models/tag.rb
index 858f674c3..87894a7b2 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -10,7 +10,6 @@
 #  local      :boolean          default(FALSE), not null
 #  private    :boolean          default(FALSE), not null
 #  unlisted   :boolean          default(FALSE), not null
-#  chat       :boolean          default(FALSE), not null
 #
 
 class Tag < ApplicationRecord
@@ -19,8 +18,6 @@ class Tag < ApplicationRecord
   has_and_belongs_to_many :sample_accounts, -> { searchable.discoverable.popular.limit(3) }, class_name: 'Account'
 
   has_many :featured_tags, dependent: :destroy, inverse_of: :tag
-  has_many :chat_accounts, dependent: :destroy, inverse_of: :tag
-  has_many :chatters, through: :chat_accounts, source: :account
 
   has_one :account_tag_stat, dependent: :destroy
 
@@ -37,7 +34,6 @@ class Tag < ApplicationRecord
   scope :only_global, -> { where(local: false, unlisted: false) }
   scope :only_private, -> { where(private: true) }
   scope :only_unlisted, -> { where(unlisted: true) }
-  scope :only_chat, -> { where(chat: true) }
   scope :only_public, -> { where(unlisted: false) }
 
   delegate :accounts_count,
@@ -109,9 +105,8 @@ class Tag < ApplicationRecord
   def set_scope
     self.private = true if name.in?(%w(self .self)) || name.starts_with?('self.', '.self.')
     self.unlisted = true if self.private || name.starts_with?('.')
-    self.chat = true if name.starts_with?('chat.', '.chat')
     self.local = true if self.private ||
-      name.in?(%w(local .local chat.local .chat.local)) ||
-      name.starts_with?('local.', '.local', 'chat.local.' '.chat.local')
+      name.in?(%w(local .local)) ||
+      name.starts_with?('local.', '.local')
   end
 end
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index 85d2482db..5ca962291 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -7,14 +7,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
 
   context_extensions :manually_approves_followers, :featured, :also_known_as,
                      :moved_to, :property_value, :hashtag, :emoji, :identity_proof,
-                     :adult_content, :gently, :kobold, :supports_chat, :froze
+                     :adult_content, :gently, :kobold, :froze
 
   attributes :id, :type, :following, :followers,
              :inbox, :outbox, :featured,
              :preferred_username, :name, :summary,
              :url, :manually_approves_followers,
              :gently, :kobold, :adult_content,
-             :supports_chat, :froze
+             :froze
 
   has_one :public_key, serializer: ActivityPub::PublicKeySerializer
 
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index bd98989e2..30fe4897f 100644
--- a/app/serializers/rest/account_serializer.rb
+++ b/app/serializers/rest/account_serializer.rb
@@ -6,7 +6,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
   attributes :id, :username, :acct, :display_name, :locked, :bot, :created_at,
              :note, :url, :avatar, :avatar_static, :header, :header_static,
              :followers_count, :following_count, :statuses_count, :replies,
-             :adult_content, :supports_chat, :gently, :kobold, :role, :froze
+             :adult_content, :gently, :kobold, :role, :froze
 
   has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
   has_many :emojis, serializer: REST::CustomEmojiSerializer
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index 284e634df..58ee81d1a 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -58,7 +58,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
   def visibility
     if object.limited_visibility?
       'private'
-    elsif object.local_visibility? || object.chat_visibility?
+    elsif object.local_visibility?
       'unlisted'
     else
       object.visibility
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index bc1eb2057..7579579f3 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -81,7 +81,6 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.locked                  = @json['manuallyApprovesFollowers'] || false
     @account.froze                   = @json['froze'] || false
     @account.adult_content           = @json['adultContent'] || (@json['suggestedMinAge'].to_i >= 18)
-    @account.supports_chat           = @json['supportsChat'] || false
     @account.gently                  = @json['gently'] || false
     @account.kobold                  = @json['kobold'] || false
     @account.fields                  = property_values || {}
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 9b959617d..235c156f5 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -6,7 +6,7 @@ class FanOutOnWriteService < BaseService
   def call(status)
     raise Mastodon::RaceConditionError if status.visibility.nil?
 
-    deliver_to_self(status) if status.account.local? && !status.chat_visibility?
+    deliver_to_self(status) if status.account.local?
 
     render_anonymous_payload(status)
 
@@ -16,9 +16,6 @@ class FanOutOnWriteService < BaseService
       deliver_to_own_conversation(status)
     elsif status.limited_visibility?
       deliver_to_mentioned_followers(status)
-    elsif status.chat_visibility?
-      deliver_to_mentioned_followers(status)
-      deliver_to_hashtags(status)
     elsif status.local_visibility?
       deliver_to_followers(status)
       return if status.reblog? && !Setting.show_reblogs_in_public_timelines
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 65f0c88ce..c26f76a1b 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -13,7 +13,6 @@ class PostStatusService < BaseService
     'private'   => 2,
     'direct'    => 3,
     'limited'   => 3,
-    'chat'      => 4
   }
 
   # Post a text status update, fetch and notify remote users mentioned
@@ -92,19 +91,6 @@ class PostStatusService < BaseService
     @local_only = true if @account.user_always_local_only? || @in_reply_to&.local_only
   end
 
-  def set_chat
-    if @in_reply_to.present?
-      unless @in_reply_to.chat_tags.blank?
-        @preloaded_tags |= @in_reply_to.chat_tags
-        @visibility = :chat
-        @in_reply_to = nil
-      end
-    elsif @tags.present? && @tags.any? { |t| t.start_with?('chat.', '.chat.') }
-      @visibility = :chat
-      @local_only = true if @tags.any? { |t| t.in?(%w(chat.local .chat.local)) || t.start_with?('chat.local.', '.chat.local.') }
-    end
-  end
-
   # move tags out of body so we can format them later
   def extract_tags
     @text.gsub!(/^##/, "\uf666")
@@ -124,14 +110,10 @@ class PostStatusService < BaseService
 
     set_footer_from_i_am
     extract_tags
-    set_chat
     set_local_only
-
-    unless @visibility == :chat
-      set_initial_visibility
-      limit_visibility_if_silenced
-      limit_visibility_to_reply
-    end
+    set_initial_visibility
+    limit_visibility_if_silenced
+    limit_visibility_to_reply
 
     @sensitive = (@account.user_defaults_to_sensitive? || @options[:spoiler_text].present?) if @sensitive.nil?
 
@@ -166,6 +148,7 @@ class PostStatusService < BaseService
 
     process_hashtags_service.call(@status, @tags, @preloaded_tags)
     process_mentions_service.call(@status)
+
     return true
   end
 
diff --git a/app/services/process_hashtags_service.rb b/app/services/process_hashtags_service.rb
index fff4f5db1..15d78f690 100644
--- a/app/services/process_hashtags_service.rb
+++ b/app/services/process_hashtags_service.rb
@@ -13,20 +13,13 @@ class ProcessHashtagsService < BaseService
       name.gsub!(/[:.]+/, '.')
       next if name.blank? || name == '.'
 
-      chat = name.starts_with?('chat.', '.chat.')
-      if chat
-        component_indices = [name.size - 1]
-      else
-        component_indices = 1.upto(name.size).select { |i| name[i] == '.' }
-        component_indices << name.size - 1
-      end
+      component_indices = 1.upto(name.size).select { |i| name[i] == '.' }
+      component_indices << name.size - 1
 
       component_indices.take(6).each_with_index do |i, nest|
         frag = (nest != 5) ? name[0..i] : name
         tag = Tag.where(name: frag).first_or_create(name: frag)
 
-        tag.chatters.find_or_create_by(id: status.account_id) if chat
-
         next if status.tags.include?(tag)
         status.tags << tag
         next if tag.unlisted || component_indices.size > 1
diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml
index 18addcd50..9a68e82e9 100644
--- a/app/views/settings/profiles/show.html.haml
+++ b/app/views/settings/profiles/show.html.haml
@@ -25,7 +25,6 @@
     = f.input :hidden, as: :boolean, wrapper: :with_label
     = f.input :unlisted, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.unlisted')
     = f.input :replies, as: :boolean, wrapper: :with_label
-    = f.input :supports_chat, as: :boolean, wrapper: :with_label
 
   .fields-group
     = f.input :adult_content, as: :boolean, wrapper: :with_label
diff --git a/app/workers/activitypub/distribute_poll_update_worker.rb b/app/workers/activitypub/distribute_poll_update_worker.rb
index 34eed9ab2..310e42433 100644
--- a/app/workers/activitypub/distribute_poll_update_worker.rb
+++ b/app/workers/activitypub/distribute_poll_update_worker.rb
@@ -35,7 +35,7 @@ class ActivityPub::DistributePollUpdateWorker
       end
     end
 
-    @inboxes.concat(@account.followers.inboxes) unless @status.direct_visibility? || @status.chat_visibility?
+    @inboxes.concat(@account.followers.inboxes) unless @status.direct_visibility?
     @inboxes.uniq!
     @inboxes.compact!
     @inboxes
diff --git a/app/workers/activitypub/distribution_worker.rb b/app/workers/activitypub/distribution_worker.rb
index 67c3054e5..d83f01700 100644
--- a/app/workers/activitypub/distribution_worker.rb
+++ b/app/workers/activitypub/distribution_worker.rb
@@ -23,7 +23,7 @@ class ActivityPub::DistributionWorker
   private
 
   def skip_distribution?
-    @status.direct_visibility? || @status.limited_visibility? || @status.chat_visibility?
+    @status.direct_visibility? || @status.limited_visibility?
   end
 
   def relayable?