Enable frozen string literals.
Make all string literals immutable by default.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationHelper
|
||||
def listing_type(*fields, member_check: true, types: [:revert, :standard])
|
||||
(fields.reduce(false) { |acc, field| acc || params.dig(:search, field).present? } && (!member_check || CurrentUser.is_member?) ? types[0] : types[1])
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ArtistCommentariesHelper
|
||||
def format_commentary_title(title, classes: "")
|
||||
tag.h3 do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ArtistCommentaryVersionsHelper
|
||||
def commentary_version_field_diff(commentary_version, type, field)
|
||||
other = commentary_version.send(params[:type])
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ArtistVersionsHelper
|
||||
def artist_version_other_names_diff(artist_version, type)
|
||||
other = artist_version.send(type)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ComponentsHelper
|
||||
def post_preview(post, fit: :fixed, **options)
|
||||
render PostPreviewComponent.new(post: post, fit: fit, **options)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module DelayedJobsHelper
|
||||
def print_name(job)
|
||||
case job.name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ForumTopicsHelper
|
||||
def forum_topic_category_select(object, field)
|
||||
select(object, field, ForumTopic.reverse_category_mapping.to_a)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module IconHelper
|
||||
def icon_tag(icon_class, class: nil, **options)
|
||||
klass = binding.local_variable_get(:class)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module IpAddressesHelper
|
||||
# https://www.bing.com/maps/embed-a-map
|
||||
# https://docs.microsoft.com/en-us/bingmaps/articles/create-a-custom-map-url
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module NoteVersionsHelper
|
||||
def note_version_position_diff(note_version, type)
|
||||
other = note_version.send(type)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PoolVersionsHelper
|
||||
def pool_version_show_diff(pool_version, type)
|
||||
other = pool_version.send(type)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PopularPostsHelper
|
||||
def next_date_for_scale(date, scale)
|
||||
case scale
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PostVersionsHelper
|
||||
def post_version_diff(post_version, type)
|
||||
return "" if type == "previous" && post_version.version == 1
|
||||
@@ -22,7 +24,7 @@ module PostVersionsHelper
|
||||
obsolete_added_tags = added_tags - other_tags
|
||||
obsolete_removed_tags = removed_tags & other_tags
|
||||
end
|
||||
html = '<span class="diff-list">'
|
||||
html = '<span class="diff-list">'.dup
|
||||
|
||||
added_tags.each do |tag|
|
||||
obsolete_class = (obsolete_added_tags.include?(tag) ? "diff-obsolete" : "")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PostsHelper
|
||||
def reportbooru_enabled?
|
||||
Danbooru.config.reportbooru_server.present? && Danbooru.config.reportbooru_key.present?
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# https://yoast.com/structured-data-schema-ultimate-guide/
|
||||
# https://technicalseo.com/tools/schema-markup-generator/
|
||||
# https://developers.google.com/search/docs/data-types/sitelinks-searchbox
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module TagsHelper
|
||||
def tag_class(tag)
|
||||
return nil if tag.blank?
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module UploadsHelper
|
||||
def render_status(upload)
|
||||
case upload.status
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module UserUpgradesHelper
|
||||
def cents_to_usd(cents)
|
||||
number_to_currency(cents / 100, precision: 0)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module UsersHelper
|
||||
def unread_dmail_indicator(user)
|
||||
"(#{user.unread_dmail_count})" if user.unread_dmail_count > 0
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module WikiPageVersionsHelper
|
||||
def wiki_version_show_diff(wiki_page_version, type)
|
||||
other = wiki_page_version.send(type)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module WikiPagesHelper
|
||||
def wiki_page_other_names_list(wiki_page)
|
||||
names_html = wiki_page.other_names.map do |name|
|
||||
|
||||
Reference in New Issue
Block a user