mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
fix lint, improve performance
This commit is contained in:
parent
c27bb90e4d
commit
a9f55aa310
1 changed files with 7 additions and 5 deletions
|
@ -104,6 +104,8 @@ module Invidious::Comments
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mutations = response.dig?("frameworkUpdates", "entityBatchUpdate", "mutations").try &.as_a || [] of JSON::Any
|
||||||
|
|
||||||
response = JSON.build do |json|
|
response = JSON.build do |json|
|
||||||
json.object do
|
json.object do
|
||||||
if header
|
if header
|
||||||
|
@ -135,9 +137,9 @@ module Invidious::Comments
|
||||||
cvm = node.dig("commentViewModel", "commentViewModel")
|
cvm = node.dig("commentViewModel", "commentViewModel")
|
||||||
comment_key = cvm["commentKey"]
|
comment_key = cvm["commentKey"]
|
||||||
toolbar_key = cvm["toolbarStateKey"]
|
toolbar_key = cvm["toolbarStateKey"]
|
||||||
if mutations = response.dig?("frameworkUpdates", "entityBatchUpdate", "mutations")
|
if mutations.size != 0
|
||||||
comment_mutation = mutations.as_a.find { |i| i.dig?("payload", "commentEntityPayload", "key") == comment_key}
|
comment_mutation = mutations.find { |i| i.dig?("payload", "commentEntityPayload", "key") == comment_key }
|
||||||
toolbar_mutation = mutations.as_a.find { |i| i.dig?("entityKey") == toolbar_key}
|
toolbar_mutation = mutations.find { |i| i.dig?("entityKey") == toolbar_key }
|
||||||
if !comment_mutation.nil? && !toolbar_mutation.nil?
|
if !comment_mutation.nil? && !toolbar_mutation.nil?
|
||||||
html_content = comment_mutation.dig("payload", "commentEntityPayload", "properties", "content", "content").as_s
|
html_content = comment_mutation.dig("payload", "commentEntityPayload", "properties", "content", "content").as_s
|
||||||
if comment_author = comment_mutation.dig?("payload", "commentEntityPayload", "author")
|
if comment_author = comment_mutation.dig?("payload", "commentEntityPayload", "author")
|
||||||
|
|
Loading…
Reference in a new issue