forked from e621ng/e621ng
[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:
parent
4975c1f717
commit
bc06f8cea2
@ -4,7 +4,7 @@ module CommentsHelper
|
|||||||
|
|
||||||
voted = !vote.nil?
|
voted = !vote.nil?
|
||||||
vote_score = voted ? vote.score : 0
|
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?
|
if CurrentUser.is_member?
|
||||||
up_tag = tag.li(
|
up_tag = tag.li(
|
||||||
@ -17,10 +17,9 @@ module CommentsHelper
|
|||||||
class: confirm_score_class(vote_score, -1, false),
|
class: confirm_score_class(vote_score, -1, false),
|
||||||
id: "comment-vote-down-#{comment.id}",
|
id: "comment-vote-down-#{comment.id}",
|
||||||
)
|
)
|
||||||
|
up_tag + score_tag + down_tag
|
||||||
else
|
else
|
||||||
up_tag = down_tag = "".html_safe
|
score_tag
|
||||||
end
|
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,30 +1,22 @@
|
|||||||
module NoteVersionsHelper
|
module NoteVersionsHelper
|
||||||
def note_version_body_diff_info(note_version)
|
def note_version_body_diff_info(note_version)
|
||||||
previous = note_version.previous
|
previous = note_version.previous
|
||||||
if previous.nil?
|
if note_version.body == previous&.body
|
||||||
return ""
|
tag.span("(body not changed)", class: "inactive")
|
||||||
|
else
|
||||||
|
""
|
||||||
end
|
end
|
||||||
|
|
||||||
html = ""
|
|
||||||
if note_version.body == previous.body
|
|
||||||
html += '<span class="inactive">(body not changed)</span>'
|
|
||||||
end
|
|
||||||
|
|
||||||
html.html_safe
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def note_version_position_diff(note_version)
|
def note_version_position_diff(note_version)
|
||||||
previous = note_version.previous
|
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}"
|
if note_version.x == previous.x && note_version.y == previous.y && note_version.width == previous.width && note_version.height == previous.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
|
|
||||||
html
|
html
|
||||||
else
|
else
|
||||||
html = '<span style="text-decoration: underline;">' + html + '</span>'
|
tag.span(html, style: "text-decoration: underline;")
|
||||||
html.html_safe
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ module PostsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def has_parent_message(post, parent_post_set)
|
def has_parent_message(post, parent_post_set)
|
||||||
html = ""
|
html = +""
|
||||||
|
|
||||||
html << "Parent: "
|
html << "Parent: "
|
||||||
html << link_to("post ##{post.parent_id}", post_path(id: post.parent_id))
|
html << link_to("post ##{post.parent_id}", post_path(id: post.parent_id))
|
||||||
@ -56,7 +56,7 @@ module PostsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def has_children_message(post, children_post_set)
|
def has_children_message(post, children_post_set)
|
||||||
html = ""
|
html = +""
|
||||||
|
|
||||||
html << "Children: "
|
html << "Children: "
|
||||||
text = children_post_set.children.count == 1 ? "1 child" : "#{children_post_set.children.count} children"
|
text = children_post_set.children.count == 1 ? "1 child" : "#{children_post_set.children.count} children"
|
||||||
|
@ -35,7 +35,7 @@ class ApngInspector
|
|||||||
#We could be dealing with large number of chunks,
|
#We could be dealing with large number of chunks,
|
||||||
#so the code should be optimized to create as few objects as possible.
|
#so the code should be optimized to create as few objects as possible.
|
||||||
#All literal strings are frozen and read() function uses string buffer.
|
#All literal strings are frozen and read() function uses string buffer.
|
||||||
chunkheader = ''
|
chunkheader = +""
|
||||||
while file.read(8, chunkheader)
|
while file.read(8, chunkheader)
|
||||||
#ensure that first 8 bytes from chunk were read properly
|
#ensure that first 8 bytes from chunk were read properly
|
||||||
if chunkheader == nil || chunkheader.length < 8
|
if chunkheader == nil || chunkheader.length < 8
|
||||||
|
@ -16,7 +16,7 @@ class TagSetPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def post_index_sidebar_tag_list_html(current_query: "")
|
def post_index_sidebar_tag_list_html(current_query: "")
|
||||||
html = ""
|
html = +""
|
||||||
if ordered_tags.present?
|
if ordered_tags.present?
|
||||||
html << '<ul>'
|
html << '<ul>'
|
||||||
ordered_tags.each do |tag|
|
ordered_tags.each do |tag|
|
||||||
@ -29,7 +29,7 @@ class TagSetPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def post_show_sidebar_tag_list_html(current_query: "", highlighted_tags:)
|
def post_show_sidebar_tag_list_html(current_query: "", highlighted_tags:)
|
||||||
html = ""
|
html = +""
|
||||||
|
|
||||||
TagCategory::SPLIT_HEADER_LIST.each do |category|
|
TagCategory::SPLIT_HEADER_LIST.each do |category|
|
||||||
typetags = tags_for_category(category)
|
typetags = tags_for_category(category)
|
||||||
|
Loading…
Reference in New Issue
Block a user