Simplify cvm assignment logic
Co-authored-by: Samantaz Fox <coding@samantaz.fr>
This commit is contained in:
parent
fbf07e18aa
commit
9d591a2214
|
@ -133,11 +133,11 @@ module Invidious::Comments
|
|||
node_replies = node["replies"]["commentRepliesRenderer"]
|
||||
end
|
||||
|
||||
if node["commentViewModel"]?
|
||||
if cvm = node["commentViewModel"]?
|
||||
# two commentViewModels for inital request
|
||||
cvm = node.dig?("commentViewModel", "commentViewModel")
|
||||
# one commentViewModel when getting a replies to a comment
|
||||
cvm ||= node.dig("commentViewModel")
|
||||
cvm = cvm["commentViewModel"] if cvm["commentViewModel"]?
|
||||
|
||||
comment_key = cvm["commentKey"]
|
||||
toolbar_key = cvm["toolbarStateKey"]
|
||||
comment_mutation = mutations.find { |i| i.dig?("payload", "commentEntityPayload", "key") == comment_key }
|
||||
|
|
Loading…
Reference in New Issue