summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/accounts_controller.rb7
-rw-r--r--app/controllers/statuses_controller.rb36
-rw-r--r--app/controllers/stream_entries_controller.rb64
-rw-r--r--app/helpers/admin/action_logs_helper.rb2
-rw-r--r--app/helpers/home_helper.rb2
-rw-r--r--app/helpers/statuses_helper.rb (renamed from app/helpers/stream_entries_helper.rb)4
-rw-r--r--app/javascript/styles/application.scss2
-rw-r--r--app/javascript/styles/mastodon/statuses.scss (renamed from app/javascript/styles/mastodon/stream_entries.scss)0
-rw-r--r--app/lib/formatter.rb2
-rw-r--r--app/lib/ostatus/atom_serializer.rb376
-rw-r--r--app/lib/status_finder.rb2
-rw-r--r--app/lib/tag_manager.rb11
-rw-r--r--app/mailers/admin_mailer.rb2
-rw-r--r--app/mailers/notification_mailer.rb2
-rw-r--r--app/models/concerns/account_associations.rb1
-rw-r--r--app/models/concerns/streamable.rb43
-rw-r--r--app/models/remote_profile.rb57
-rw-r--r--app/models/status.rb4
-rw-r--r--app/models/stream_entry.rb59
-rw-r--r--app/serializers/rest/account_serializer.rb2
-rw-r--r--app/serializers/rest/status_serializer.rb6
-rw-r--r--app/serializers/rss/account_serializer.rb6
-rw-r--r--app/serializers/rss/tag_serializer.rb4
-rw-r--r--app/services/batched_remove_status_service.rb2
-rw-r--r--app/services/fetch_link_card_service.rb2
-rw-r--r--app/services/process_mentions_service.rb2
-rw-r--r--app/services/remove_status_service.rb15
-rw-r--r--app/services/resolve_url_service.rb5
-rw-r--r--app/services/suspend_account_service.rb1
-rw-r--r--app/views/accounts/_moved.html.haml4
-rw-r--r--app/views/accounts/show.html.haml4
-rw-r--r--app/views/admin/accounts/_account.html.haml2
-rw-r--r--app/views/admin/reports/_status.html.haml2
-rw-r--r--app/views/application/_card.html.haml2
-rw-r--r--app/views/authorize_interactions/_post_follow_actions.html.haml2
-rw-r--r--app/views/remote_interaction/new.html.haml2
-rw-r--r--app/views/remote_unfollows/_card.html.haml2
-rw-r--r--app/views/remote_unfollows/_post_follow_actions.html.haml2
-rw-r--r--app/views/statuses/_attachment_list.html.haml (renamed from app/views/stream_entries/_attachment_list.html.haml)0
-rw-r--r--app/views/statuses/_detailed_status.html.haml (renamed from app/views/stream_entries/_detailed_status.html.haml)10
-rw-r--r--app/views/statuses/_og_description.html.haml (renamed from app/views/stream_entries/_og_description.html.haml)0
-rw-r--r--app/views/statuses/_og_image.html.haml (renamed from app/views/stream_entries/_og_image.html.haml)0
-rw-r--r--app/views/statuses/_poll.html.haml (renamed from app/views/stream_entries/_poll.html.haml)0
-rw-r--r--app/views/statuses/_simple_status.html.haml (renamed from app/views/stream_entries/_simple_status.html.haml)10
-rw-r--r--app/views/statuses/_status.html.haml (renamed from app/views/stream_entries/_status.html.haml)12
-rw-r--r--app/views/statuses/embed.html.haml3
-rw-r--r--app/views/statuses/show.html.haml24
-rw-r--r--app/views/stream_entries/embed.html.haml3
-rw-r--r--app/views/stream_entries/show.html.haml25
-rw-r--r--config/routes.rb6
-rw-r--r--db/post_migrate/20190706233204_drop_stream_entries.rb13
-rw-r--r--db/schema.rb14
-rw-r--r--spec/controllers/accounts_controller_spec.rb31
-rw-r--r--spec/controllers/api/oembed_controller_spec.rb2
-rw-r--r--spec/controllers/application_controller_spec.rb4
-rw-r--r--spec/controllers/statuses_controller_spec.rb16
-rw-r--r--spec/controllers/stream_entries_controller_spec.rb95
-rw-r--r--spec/fabricators/stream_entry_fabricator.rb5
-rw-r--r--spec/helpers/admin/account_moderation_notes_helper_spec.rb2
-rw-r--r--spec/helpers/statuses_helper_spec.rb (renamed from spec/helpers/stream_entries_helper_spec.rb)10
-rw-r--r--spec/lib/activitypub/tag_manager_spec.rb6
-rw-r--r--spec/lib/ostatus/atom_serializer_spec.rb1415
-rw-r--r--spec/lib/status_finder_spec.rb9
-rw-r--r--spec/lib/tag_manager_spec.rb42
-rw-r--r--spec/models/concerns/streamable_spec.rb63
-rw-r--r--spec/models/remote_profile_spec.rb143
-rw-r--r--spec/models/stream_entry_spec.rb192
-rw-r--r--spec/services/process_mentions_service_spec.rb4
-rw-r--r--spec/services/suspend_account_service_spec.rb6
-rw-r--r--spec/views/statuses/show.html.haml_spec.rb (renamed from spec/views/stream_entries/show.html.haml_spec.rb)13
70 files changed, 130 insertions, 2791 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 73a4b1859c3..0657073780e 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -31,13 +31,6 @@ class AccountsController < ApplicationController
end
end
- format.atom do
- mark_cacheable!
-
- @entries = @account.stream_entries.where(hidden: false).with_includes.paginate_by_max_id(PAGE_SIZE, params[:max_id], params[:since_id])
- render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, @entries.reject { |entry| entry.status.nil? }))
- end
-
format.rss do
mark_cacheable!
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb
index ef26691b296..776099ca872 100644
--- a/app/controllers/statuses_controller.rb
+++ b/app/controllers/statuses_controller.rb
@@ -33,12 +33,10 @@ class StatusesController < ApplicationController
set_ancestors
set_descendants
-
- render 'stream_entries/show'
end
format.json do
- render_cached_json(['activitypub', 'note', @status], content_type: 'application/activity+json', public: !@stream_entry.hidden?) do
+ render_cached_json(['activitypub', 'note', @status], content_type: 'application/activity+json', public: @status.distributable?) do
ActiveModelSerializers::SerializableResource.new(@status, serializer: ActivityPub::NoteSerializer, adapter: ActivityPub::Adapter)
end
end
@@ -46,7 +44,7 @@ class StatusesController < ApplicationController
end
def activity
- render_cached_json(['activitypub', 'activity', @status], content_type: 'application/activity+json', public: !@stream_entry.hidden?) do
+ render_cached_json(['activitypub', 'activity', @status], content_type: 'application/activity+json', public: @status.distributable?) do
ActiveModelSerializers::SerializableResource.new(@status, serializer: ActivityPub::ActivitySerializer, adapter: ActivityPub::Adapter)
end
end
@@ -58,7 +56,7 @@ class StatusesController < ApplicationController
response.headers['X-Frame-Options'] = 'ALLOWALL'
@autoplay = ActiveModel::Type::Boolean.new.cast(params[:autoplay])
- render 'stream_entries/embed', layout: 'embedded'
+ render layout: 'embedded'
end
def replies
@@ -92,11 +90,20 @@ class StatusesController < ApplicationController
def create_descendant_thread(starting_depth, statuses)
depth = starting_depth + statuses.size
+
if depth < DESCENDANTS_DEPTH_LIMIT
- { statuses: statuses, starting_depth: starting_depth }
+ {
+ statuses: statuses,
+ starting_depth: starting_depth,
+ }
else
next_status = statuses.pop
- { statuses: statuses, starting_depth: starting_depth, next_status: next_status }
+
+ {
+ statuses: statuses,
+ starting_depth: starting_depth,
+ next_status: next_status,
+ }
end
end
@@ -164,22 +171,13 @@ class StatusesController < ApplicationController
end
def set_link_headers
- response.headers['Link'] = LinkHeader.new(
- [
- [account_stream_entry_url(@account, @status.stream_entry, format: 'atom'), [%w(rel alternate), %w(type application/atom+xml)]],
- [ActivityPub::TagManager.instance.uri_for(@status), [%w(rel alternate), %w(type application/activity+json)]],
- ]
- )
+ response.headers['Link'] = LinkHeader.new([[ActivityPub::TagManager.instance.uri_for(@status), [%w(rel alternate), %w(type application/activity+json)]]])
end
def set_status
- @status = @account.statuses.find(params[:id])
- @stream_entry = @status.stream_entry
- @type = @stream_entry.activity_type.downcase
-
+ @status = @account.statuses.find(params[:id])
authorize @status, :show?
rescue Mastodon::NotPermittedError
- # Reraise in order to get a 404
raise ActiveRecord::RecordNotFound
end
@@ -192,7 +190,7 @@ class StatusesController < ApplicationController
end
def redirect_to_original
- redirect_to ::TagManager.instance.url_for(@status.reblog) if @status.reblog?
+ redirect_to ActivityPub::TagManager.instance.url_for(@status.reblog) if @status.reblog?
end
def set_referrer_policy_header
diff --git a/app/controllers/stream_entries_controller.rb b/app/controllers/stream_entries_controller.rb
deleted file mode 100644
index 0f7e9e0f569..00000000000
--- a/app/controllers/stream_entries_controller.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-# frozen_string_literal: true
-
-class StreamEntriesController < ApplicationController
- include Authorization
- include SignatureVerification
-
- layout 'public'
-
- before_action :set_account
- before_action :set_stream_entry
- before_action :set_link_headers
- before_action :check_account_suspension
- before_action :set_cache_headers
-
- def show
- respond_to do |format|
- format.html do
- expires_in 5.minutes, public: true unless @stream_entry.hidden?
-
- redirect_to short_account_status_url(params[:account_username], @stream_entry.activity)
- end
-
- format.atom do
- expires_in 3.minutes, public: true unless @stream_entry.hidden?
-
- render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.entry(@stream_entry, true))
- end
- end
- end
-
- def embed
- redirect_to embed_short_account_status_url(@account, @stream_entry.activity), status: 301
- end
-
- private
-
- def set_account
- @account = Account.find_local!(params[:account_username])
- end
-
- def set_link_headers
- response.headers['Link'] = LinkHeader.new(
- [
- [account_stream_entry_url(@account, @stream_entry, format: 'atom'), [%w(rel alternate), %w(type application/atom+xml)]],
- [ActivityPub::TagManager.instance.uri_for(@stream_entry.activity), [%w(rel alternate), %w(type application/activity+json)]],
- ]
- )
- end
-
- def set_stream_entry
- @stream_entry = @account.stream_entries.where(activity_type: 'Status').find(params[:id])
- @type = 'status'
-
- raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
- authorize @stream_entry.activity, :show? if @stream_entry.hidden?
- rescue Mastodon::NotPermittedError
- # Reraise in order to get a 404
- raise ActiveRecord::RecordNotFound
- end
-
- def check_account_suspension
- gone if @account.suspended?
- end
-end
diff --git a/app/helpers/admin/action_logs_helper.rb b/app/helpers/admin/action_logs_helper.rb
index e5fbb1500e9..1daa6077459 100644
--- a/app/helpers/admin/action_logs_helper.rb
+++ b/app/helpers/admin/action_logs_helper.rb
@@ -89,7 +89,7 @@ module Admin::ActionLogsHelper
when 'DomainBlock', 'EmailDomainBlock'
link_to record.domain, "https://#{record.domain}"
when 'Status'
- link_to record.account.acct, TagManager.instance.url_for(record)
+ link_to record.account.acct, ActivityPub::TagManager.instance.url_for(record)
when 'AccountWarning'
link_to record.target_account.acct, admin_account_path(record.target_account_id)
end
diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb
index df60b7dd7ac..b66e827fee2 100644
--- a/app/helpers/home_helper.rb
+++ b/app/helpers/home_helper.rb
@@ -21,7 +21,7 @@ module HomeHelper
end
end