[Misc] Fix all remaining (hopefully) issues with frozen string literals

+"" is a bit of a copout, that could be done better but very easy to do in these more complicated cases
This commit is contained in:
Earlopain 2024-02-25 16:41:35 +01:00
parent 4975c1f717
commit bc06f8cea2
No known key found for this signature in database
GPG Key ID: 48860312319ADF61
5 changed files with 16 additions and 25 deletions

View File

@ -4,7 +4,7 @@ module CommentsHelper
voted = !vote.nil?
vote_score = voted ? vote.score : 0
comment_score = comment.score
score_tag = tag.li(comment.score, class: "comment-score #{score_class(comment.score)}", id: "comment-score-#{comment.id}")
if CurrentUser.is_member?
up_tag = tag.li(
@ -17,10 +17,9 @@ module CommentsHelper
class: confirm_score_class(vote_score, -1, false),
id: "comment-vote-down-#{comment.id}",
)
else
up_tag = down_tag = "".html_safe
end
score_tag = tag.li(comment.score, class: "comment-score #{score_class(comment_score)}", id: "comment-score-#{comment.id}")
up_tag + score_tag + down_tag
else
score_tag
end
end
end

View File

@ -1,30 +1,22 @@
module NoteVersionsHelper
def note_version_body_diff_info(note_version)
previous = note_version.previous
if previous.nil?
return ""
if note_version.body == previous&.body
tag.span("(body not changed)", class: "inactive")
else
""
end
html = ""
if note_version.body == previous.body
html += '<span class="inactive">(body not changed)</span>'
end
html.html_safe
end
def note_version_position_diff(note_version)
previous = note_version.previous
html = "#{note_version.width}x#{note_version.height} #{note_version.x},#{note_version.y}"
return html if previous.nil?
html = "#{note_version.width}x#{note_version.height}"
html += " #{note_version.x},#{note_version.y}"
if previous.nil?
html
elsif note_version.x == previous.x && note_version.y == previous.y && note_version.width == previous.width && note_version.height == previous.height
if note_version.x == previous.x && note_version.y == previous.y && note_version.width == previous.width && note_version.height == previous.height
html
else
html = '<span style="text-decoration: underline;">' + html + '</span>'
html.html_safe
tag.span(html, style: "text-decoration: underline;")
end
end
end

View File

@ -35,7 +35,7 @@ module PostsHelper
end
def has_parent_message(post, parent_post_set)
html = ""
html = +""
html << "Parent: "
html << link_to("post ##{post.parent_id}", post_path(id: post.parent_id))
@ -56,7 +56,7 @@ module PostsHelper
end
def has_children_message(post, children_post_set)
html = ""
html = +""
html << "Children: "
text = children_post_set.children.count == 1 ? "1 child" : "#{children_post_set.children.count} children"

View File

@ -35,7 +35,7 @@ class ApngInspector
#We could be dealing with large number of chunks,
#so the code should be optimized to create as few objects as possible.
#All literal strings are frozen and read() function uses string buffer.
chunkheader = ''
chunkheader = +""
while file.read(8, chunkheader)
#ensure that first 8 bytes from chunk were read properly
if chunkheader == nil || chunkheader.length < 8

View File

@ -16,7 +16,7 @@ class TagSetPresenter < Presenter
end
def post_index_sidebar_tag_list_html(current_query: "")
html = ""
html = +""
if ordered_tags.present?
html << '<ul>'
ordered_tags.each do |tag|
@ -29,7 +29,7 @@ class TagSetPresenter < Presenter
end
def post_show_sidebar_tag_list_html(current_query: "", highlighted_tags:)
html = ""
html = +""
TagCategory::SPLIT_HEADER_LIST.each do |category|
typetags = tags_for_category(category)