about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-07-24 13:01:12 -0500
committermultiple creatures <dev@multiple-creature.party>2019-07-24 13:01:12 -0500
commit25d628fca314aebb25e3976f006cc96629a3d780 (patch)
treebb4304947f7727264038b90b0e48a9783a1f30ff /app/services
parentd83fcfd1f15a97bfb5c6f36a82d7253175518daf (diff)
revert the current unfinished chat implementation
Diffstat (limited to 'app/services')
-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
4 files changed, 7 insertions, 35 deletions
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