about summary refs log tree commit diff
path: root/spec/controllers/api/v1/statuses_controller_spec.rb
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-08-26 18:09:33 -0500
committerStarfall <us@starfall.systems>2022-08-26 18:09:33 -0500
commitb581e6b6d4a5ba9ed4ae17427b7f2d5d158be4e5 (patch)
tree06c3f6859d5cee4794d678a0aa57d15c31036ce4 /spec/controllers/api/v1/statuses_controller_spec.rb
parent3871928aa4f660cdf1a0c451ac3396052b59ddea (diff)
parent978dd7e73c911441503ff803ffdce544ce50a33d (diff)
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'spec/controllers/api/v1/statuses_controller_spec.rb')
-rw-r--r--spec/controllers/api/v1/statuses_controller_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/statuses_controller_spec.rb b/spec/controllers/api/v1/statuses_controller_spec.rb
index 4d104a198..24810a5d2 100644
--- a/spec/controllers/api/v1/statuses_controller_spec.rb
+++ b/spec/controllers/api/v1/statuses_controller_spec.rb
@@ -47,6 +47,33 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
         end
       end
 
+      context 'when post is explicitly filtered' do
+        let(:status) { Fabricate(:status, text: 'hello world') }
+
+        before do
+          filter = user.account.custom_filters.create!(phrase: 'filter1', context: %w(home), action: :hide)
+          filter.statuses.create!(status_id: status.id)
+        end
+
+        it 'returns http success' do
+          get :show, params: { id: status.id }
+          expect(response).to have_http_status(200)
+        end
+
+        it 'returns filter information' do
+          get :show, params: { id: status.id }
+          json = body_as_json
+          expect(json[:filtered][0]).to include({
+            filter: a_hash_including({
+              id: user.account.custom_filters.first.id.to_s,
+              title: 'filter1',
+              filter_action: 'hide',
+            }),
+            status_matches: [status.id.to_s],
+          })
+        end
+      end
+
       context 'when reblog includes filtered terms' do
         let(:status) { Fabricate(:status, reblog: Fabricate(:status, text: 'this toot is about that banned word')) }