diff --git a/app/models/inbox_filter.rb b/app/models/inbox_filter.rb index 2ae01974..1acd21a2 100644 --- a/app/models/inbox_filter.rb +++ b/app/models/inbox_filter.rb @@ -5,10 +5,10 @@ class InboxFilter define_cursor_paginator :cursored_results, :results - KEYS = %i( + KEYS = %i[ author anonymous - ).freeze + ].freeze attr_reader :params, :user @@ -36,10 +36,10 @@ class InboxFilter case key.to_s when "author" @user.inboxes.joins(question: [:user]) - .where(questions: { users: { screen_name: value }, author_is_anonymous: false }) + .where(questions: { users: { screen_name: value }, author_is_anonymous: false }) when "anonymous" @user.inboxes.joins(:question) - .where(questions: { author_is_anonymous: true }) + .where(questions: { author_is_anonymous: true }) end end end diff --git a/spec/controllers/inbox_controller_spec.rb b/spec/controllers/inbox_controller_spec.rb index 73553f33..b939c9ac 100644 --- a/spec/controllers/inbox_controller_spec.rb +++ b/spec/controllers/inbox_controller_spec.rb @@ -103,7 +103,7 @@ describe InboxController, type: :controller do more_data_available: true, inbox_count: 16, delete_id: "ib-delete-all", - disabled: nil + disabled: nil, } end end @@ -119,7 +119,7 @@ describe InboxController, type: :controller do more_data_available: false, inbox_count: 16, delete_id: "ib-delete-all", - disabled: nil + disabled: nil, } end end @@ -136,8 +136,8 @@ describe InboxController, type: :controller do question: FactoryBot.create( :question, user: unrelated_user, - author_is_anonymous: false - ) + author_is_anonymous: false, + ), ) end let!(:generic_inbox_entry2) { Inbox.create(user:, question: FactoryBot.create(:question)) } @@ -155,7 +155,7 @@ describe InboxController, type: :controller do inbox: [], inbox_last_id: nil, more_data_available: false, - inbox_count: 0 + inbox_count: 0, } end end @@ -168,8 +168,8 @@ describe InboxController, type: :controller do question: FactoryBot.create( :question, user: other_user, - author_is_anonymous: true - ) + author_is_anonymous: true, + ), ) end @@ -180,7 +180,7 @@ describe InboxController, type: :controller do inbox: [], inbox_last_id: nil, more_data_available: false, - inbox_count: 0 + inbox_count: 0, } end end @@ -193,8 +193,8 @@ describe InboxController, type: :controller do question: FactoryBot.create( :question, user: other_user, - author_is_anonymous: false - ) + author_is_anonymous: false, + ), ) end let!(:anonymous_inbox_entry) do @@ -203,8 +203,8 @@ describe InboxController, type: :controller do question: FactoryBot.create( :question, user: other_user, - author_is_anonymous: true - ) + author_is_anonymous: true, + ), ) end @@ -216,7 +216,7 @@ describe InboxController, type: :controller do more_data_available: false, inbox_count: 1, delete_id: "ib-delete-all-author", - disabled: nil + disabled: nil, } end end @@ -232,8 +232,8 @@ describe InboxController, type: :controller do question: FactoryBot.create( :question, user: other_user, - author_is_anonymous: false - ) + author_is_anonymous: false, + ), ) end @@ -249,7 +249,7 @@ describe InboxController, type: :controller do { inbox: [*inbox_entry_fillers.reverse], more_data_available: false, - inbox_count: 9 + inbox_count: 9, } end end