Fix ruby warnings about deprecated keyword arguments.
This commit is contained in:
@@ -996,5 +996,5 @@ class PostQueryBuilder
|
||||
end
|
||||
end
|
||||
|
||||
memoize :split_query, :normalized_query
|
||||
memoize :split_query
|
||||
end
|
||||
|
||||
@@ -3,11 +3,11 @@ module PostSets
|
||||
MAX_PER_PAGE = 200
|
||||
MAX_SIDEBAR_TAGS = 25
|
||||
|
||||
attr_reader :page, :random, :post_count, :format, :tag_string, :query
|
||||
delegate :normalized_query, to: :query
|
||||
attr_reader :page, :random, :post_count, :format, :tag_string, :query, :normalized_query
|
||||
|
||||
def initialize(tags, page = 1, per_page = nil, user: CurrentUser.user, random: false, format: "html")
|
||||
@query = PostQueryBuilder.new(tags, user, safe_mode: CurrentUser.safe_mode?, hide_deleted_posts: user.hide_deleted_posts?)
|
||||
@normalized_query = query.normalized_query
|
||||
@tag_string = tags
|
||||
@page = page
|
||||
@per_page = per_page
|
||||
@@ -180,7 +180,7 @@ module PostSets
|
||||
end
|
||||
|
||||
def similar_tags
|
||||
RelatedTagCalculator.cached_similar_tags_for_search(normalized_query(implicit: false), MAX_SIDEBAR_TAGS)
|
||||
RelatedTagCalculator.cached_similar_tags_for_search(query.normalized_query(implicit: false), MAX_SIDEBAR_TAGS)
|
||||
end
|
||||
|
||||
def frequent_tags
|
||||
|
||||
@@ -101,7 +101,7 @@ class RelatedTagQuery
|
||||
other_wikis
|
||||
end
|
||||
|
||||
def serializable_hash(**options)
|
||||
def serializable_hash(options = {})
|
||||
{
|
||||
query: query,
|
||||
category: category,
|
||||
|
||||
@@ -3,7 +3,7 @@ class ServerStatus
|
||||
include ActiveModel::Serializers::JSON
|
||||
include ActiveModel::Serializers::Xml
|
||||
|
||||
def serializable_hash(*options)
|
||||
def serializable_hash(options = {})
|
||||
{
|
||||
status: {
|
||||
hostname: hostname,
|
||||
|
||||
@@ -71,7 +71,7 @@ class PostEvent
|
||||
end
|
||||
|
||||
# XXX can't use hidden_attributes because we don't inherit from ApplicationRecord.
|
||||
def serializable_hash(**options)
|
||||
def serializable_hash(options = {})
|
||||
hash = super
|
||||
hash = hash.except(:creator_id) unless is_creator_visible?
|
||||
hash
|
||||
|
||||
@@ -150,7 +150,7 @@ class SavedSearch < ApplicationRecord
|
||||
end
|
||||
|
||||
def normalized_query
|
||||
PostQueryBuilder.new(query).normalized_query.to_s
|
||||
@normalized_query ||= PostQueryBuilder.new(query).normalized_query.to_s
|
||||
end
|
||||
|
||||
def rewrite_query(old_name, new_name)
|
||||
|
||||
@@ -152,7 +152,7 @@ class PostPresenter
|
||||
end
|
||||
|
||||
def humanized_essential_tag_string
|
||||
@humanized_essential_tag_string ||= tag_set_presenter.humanized_essential_tag_string(default: "##{@post.id}")
|
||||
@humanized_essential_tag_string ||= tag_set_presenter.humanized_essential_tag_string.presence || "##{@post.id}"
|
||||
end
|
||||
|
||||
def filename_for_download
|
||||
|
||||
@@ -63,7 +63,7 @@ class TagSetPresenter
|
||||
end.reject(&:blank?).join(" \n")
|
||||
end
|
||||
|
||||
def humanized_essential_tag_string(default: "")
|
||||
def humanized_essential_tag_string
|
||||
chartags = tags_for_category("character")
|
||||
characters = chartags.max_by(5, &:post_count).map(&:unqualified_name)
|
||||
characters += ["#{chartags.size - 5} more"] if chartags.size > 5
|
||||
@@ -78,8 +78,7 @@ class TagSetPresenter
|
||||
artists = tags_for_category("artist").map(&:name).grep_v("banned_artist").to_sentence
|
||||
artists = "drawn by #{artists}" if artists.present?
|
||||
|
||||
strings = "#{characters} #{copyrights} #{artists}"
|
||||
strings.presence || default
|
||||
"#{characters} #{copyrights} #{artists}".strip
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<%= subnav_link_to "Edit", edit_artist_path(@artist), :"data-shortcut" => "e" %>
|
||||
<% end %>
|
||||
<%= subnav_link_to "History", artist_versions_path(:search => {:artist_id => @artist.id}) %>
|
||||
<% if current_page?(action: "edit") && policy(@artist).update? %>
|
||||
<% if current_page?({ action: :edit }) && policy(@artist).update? %>
|
||||
<% if @artist.is_deleted? %>
|
||||
<%= subnav_link_to "Undelete", artist_path(@artist, format: "js"), method: :put, data: {confirm: "Are you sure you want to undelete this artist?", params: "artist[is_deleted]=false"}, remote: true %>
|
||||
<% else %>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<% if policy(@pool).update? %>
|
||||
<%= subnav_link_to "Edit", edit_pool_path(@pool), "data-shortcut": "e" %>
|
||||
<% end %>
|
||||
<% if current_page?(action: :edit) %>
|
||||
<% if current_page?({ action: :edit }) %>
|
||||
<% if policy(@pool).undelete? %>
|
||||
<%= subnav_link_to "Undelete", undelete_pool_path(@pool), :method => :post, :remote => true %>
|
||||
<% elsif policy(@pool).destroy? %>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<% if policy(@wiki_page).edit? %>
|
||||
<%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page.id), "data-shortcut": "e" %>
|
||||
|
||||
<% if current_page?(action: :edit) %>
|
||||
<% if current_page?({ action: :edit }) %>
|
||||
<% if @wiki_page.is_deleted? %>
|
||||
<%= subnav_link_to "Undelete", wiki_page_path(@wiki_page.id), remote: true, method: :put, "data-params": "wiki_page[is_deleted]=false", "data-shortcut": "shift+d", "data-confirm": "Are you sure you want to undelete this wiki?" %>
|
||||
<% else %>
|
||||
|
||||
@@ -9,7 +9,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
StripeMock.stop
|
||||
end
|
||||
|
||||
def post_webhook(*args, payment_status: "paid", **metadata)
|
||||
def post_webhook(*args, metadata: {}, payment_status: "paid")
|
||||
event = StripeMock.mock_webhook_event(*args, payment_status: payment_status, metadata: metadata)
|
||||
signature = generate_stripe_signature(event)
|
||||
headers = { "Stripe-Signature": signature }
|
||||
@@ -67,7 +67,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
context "for completed event with an unpaid payment status" do
|
||||
should "not upgrade the user" do
|
||||
@user_upgrade = create(:self_gold_upgrade)
|
||||
post_webhook("checkout.session.completed", { user_upgrade_id: @user_upgrade.id, payment_status: "unpaid" })
|
||||
post_webhook("checkout.session.completed", metadata: { user_upgrade_id: @user_upgrade.id }, payment_status: "unpaid")
|
||||
|
||||
assert_response 200
|
||||
assert_equal("processing", @user_upgrade.reload.status)
|
||||
@@ -79,7 +79,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
context "to Gold" do
|
||||
should "upgrade the user" do
|
||||
@user_upgrade = create(:self_gold_upgrade)
|
||||
post_webhook("checkout.session.completed", { user_upgrade_id: @user_upgrade.id })
|
||||
post_webhook("checkout.session.completed", metadata: { user_upgrade_id: @user_upgrade.id })
|
||||
|
||||
assert_response 200
|
||||
assert_equal("complete", @user_upgrade.reload.status)
|
||||
@@ -90,7 +90,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
context "to Platinum" do
|
||||
should "upgrade the user" do
|
||||
@user_upgrade = create(:self_platinum_upgrade)
|
||||
post_webhook("checkout.session.completed", { user_upgrade_id: @user_upgrade.id })
|
||||
post_webhook("checkout.session.completed", metadata: { user_upgrade_id: @user_upgrade.id })
|
||||
|
||||
assert_response 200
|
||||
assert_equal("complete", @user_upgrade.reload.status)
|
||||
@@ -101,7 +101,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
context "from Gold to Platinum" do
|
||||
should "upgrade the user" do
|
||||
@user_upgrade = create(:self_gold_to_platinum_upgrade)
|
||||
post_webhook("checkout.session.completed", { user_upgrade_id: @user_upgrade.id })
|
||||
post_webhook("checkout.session.completed", metadata: { user_upgrade_id: @user_upgrade.id })
|
||||
|
||||
assert_response 200
|
||||
assert_equal("complete", @user_upgrade.reload.status)
|
||||
@@ -114,7 +114,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
context "to Gold" do
|
||||
should "upgrade the user" do
|
||||
@user_upgrade = create(:gift_gold_upgrade)
|
||||
post_webhook("checkout.session.completed", { user_upgrade_id: @user_upgrade.id })
|
||||
post_webhook("checkout.session.completed", metadata: { user_upgrade_id: @user_upgrade.id })
|
||||
|
||||
assert_response 200
|
||||
assert_equal("complete", @user_upgrade.reload.status)
|
||||
@@ -125,7 +125,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
context "to Platinum" do
|
||||
should "upgrade the user" do
|
||||
@user_upgrade = create(:gift_platinum_upgrade)
|
||||
post_webhook("checkout.session.completed", { user_upgrade_id: @user_upgrade.id })
|
||||
post_webhook("checkout.session.completed", metadata: { user_upgrade_id: @user_upgrade.id })
|
||||
|
||||
assert_response 200
|
||||
assert_equal("complete", @user_upgrade.reload.status)
|
||||
@@ -136,7 +136,7 @@ class WebhooksControllerTest < ActionDispatch::IntegrationTest
|
||||
context "from Gold to Platinum" do
|
||||
should "upgrade the user" do
|
||||
@user_upgrade = create(:gift_gold_to_platinum_upgrade)
|
||||
post_webhook("checkout.session.completed", { user_upgrade_id: @user_upgrade.id })
|
||||
post_webhook("checkout.session.completed", metadata: { user_upgrade_id: @user_upgrade.id })
|
||||
|
||||
assert_response 200
|
||||
assert_equal("complete", @user_upgrade.reload.status)
|
||||
|
||||
Reference in New Issue
Block a user