about summary refs log tree commit diff
path: root/app/lib/activitypub
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/lib/activitypub
parentd83fcfd1f15a97bfb5c6f36a82d7253175518daf (diff)
revert the current unfinished chat implementation
Diffstat (limited to 'app/lib/activitypub')
-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
3 files changed, 9 insertions, 19 deletions
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