Fix rubocop nits

This commit is contained in:
Andreas Nedbal 2024-01-14 21:24:59 +01:00 committed by Andreas Nedbal
parent 1ac767902b
commit 63922efb1b
2 changed files with 20 additions and 20 deletions

View File

@ -5,10 +5,10 @@ class InboxFilter
define_cursor_paginator :cursored_results, :results define_cursor_paginator :cursored_results, :results
KEYS = %i( KEYS = %i[
author author
anonymous anonymous
).freeze ].freeze
attr_reader :params, :user attr_reader :params, :user
@ -36,10 +36,10 @@ class InboxFilter
case key.to_s case key.to_s
when "author" when "author"
@user.inboxes.joins(question: [:user]) @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" when "anonymous"
@user.inboxes.joins(:question) @user.inboxes.joins(:question)
.where(questions: { author_is_anonymous: true }) .where(questions: { author_is_anonymous: true })
end end
end end
end end

View File

@ -103,7 +103,7 @@ describe InboxController, type: :controller do
more_data_available: true, more_data_available: true,
inbox_count: 16, inbox_count: 16,
delete_id: "ib-delete-all", delete_id: "ib-delete-all",
disabled: nil disabled: nil,
} }
end end
end end
@ -119,7 +119,7 @@ describe InboxController, type: :controller do
more_data_available: false, more_data_available: false,
inbox_count: 16, inbox_count: 16,
delete_id: "ib-delete-all", delete_id: "ib-delete-all",
disabled: nil disabled: nil,
} }
end end
end end
@ -136,8 +136,8 @@ describe InboxController, type: :controller do
question: FactoryBot.create( question: FactoryBot.create(
:question, :question,
user: unrelated_user, user: unrelated_user,
author_is_anonymous: false author_is_anonymous: false,
) ),
) )
end end
let!(:generic_inbox_entry2) { Inbox.create(user:, question: FactoryBot.create(:question)) } let!(:generic_inbox_entry2) { Inbox.create(user:, question: FactoryBot.create(:question)) }
@ -155,7 +155,7 @@ describe InboxController, type: :controller do
inbox: [], inbox: [],
inbox_last_id: nil, inbox_last_id: nil,
more_data_available: false, more_data_available: false,
inbox_count: 0 inbox_count: 0,
} }
end end
end end
@ -168,8 +168,8 @@ describe InboxController, type: :controller do
question: FactoryBot.create( question: FactoryBot.create(
:question, :question,
user: other_user, user: other_user,
author_is_anonymous: true author_is_anonymous: true,
) ),
) )
end end
@ -180,7 +180,7 @@ describe InboxController, type: :controller do
inbox: [], inbox: [],
inbox_last_id: nil, inbox_last_id: nil,
more_data_available: false, more_data_available: false,
inbox_count: 0 inbox_count: 0,
} }
end end
end end
@ -193,8 +193,8 @@ describe InboxController, type: :controller do
question: FactoryBot.create( question: FactoryBot.create(
:question, :question,
user: other_user, user: other_user,
author_is_anonymous: false author_is_anonymous: false,
) ),
) )
end end
let!(:anonymous_inbox_entry) do let!(:anonymous_inbox_entry) do
@ -203,8 +203,8 @@ describe InboxController, type: :controller do
question: FactoryBot.create( question: FactoryBot.create(
:question, :question,
user: other_user, user: other_user,
author_is_anonymous: true author_is_anonymous: true,
) ),
) )
end end
@ -216,7 +216,7 @@ describe InboxController, type: :controller do
more_data_available: false, more_data_available: false,
inbox_count: 1, inbox_count: 1,
delete_id: "ib-delete-all-author", delete_id: "ib-delete-all-author",
disabled: nil disabled: nil,
} }
end end
end end
@ -232,8 +232,8 @@ describe InboxController, type: :controller do
question: FactoryBot.create( question: FactoryBot.create(
:question, :question,
user: other_user, user: other_user,
author_is_anonymous: false author_is_anonymous: false,
) ),
) )
end end
@ -249,7 +249,7 @@ describe InboxController, type: :controller do
{ {
inbox: [*inbox_entry_fillers.reverse], inbox: [*inbox_entry_fillers.reverse],
more_data_available: false, more_data_available: false,
inbox_count: 9 inbox_count: 9,
} }
end end
end end