summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorAdam Niedzielski <adamsunday@gmail.com>2017-04-13 17:09:30 +0200
committerAdam Niedzielski <adamsunday@gmail.com>2017-04-13 17:09:30 +0200
commit551d0a3c03ebb74b0893252683361c280e86849e (patch)
treeacb875409e0fca57607527a6b9b3abfd0db1baba /lib/banzai
parent9daf4f646b341480cc1b9c8452b41f1b933f98fc (diff)
downloadgitlab-ce-551d0a3c03ebb74b0893252683361c280e86849e.tar.gz
Fix appending state to issuable referencesfix-appending-state-to-issuable-references
Closes #30874. Ignore nodes with no children. Append directly to the node instead of the last child of the node to avoid inheriting formatting from the last child
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/issuable_state_filter.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/banzai/filter/issuable_state_filter.rb b/lib/banzai/filter/issuable_state_filter.rb
index 6b78aa795b4..0b2b8bd7f4d 100644
--- a/lib/banzai/filter/issuable_state_filter.rb
+++ b/lib/banzai/filter/issuable_state_filter.rb
@@ -13,8 +13,8 @@ module Banzai
issuables = extractor.extract([doc])
issuables.each do |node, issuable|
- if VISIBLE_STATES.include?(issuable.state)
- node.children.last.content += " [#{issuable.state}]"
+ if VISIBLE_STATES.include?(issuable.state) && node.children.present?
+ node.add_child(Nokogiri::XML::Text.new(" [#{issuable.state}]", doc))
end
end