File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,14 +85,23 @@ def max_title_length(_category)
8585 end
8686
8787 class PostTitleScrubber < Rails ::HTML ::PermitScrubber
88- ALLOWED_ATTRS = %w[ ] . freeze
89-
90- ALLOWED_TAGS = %w[ code em strong strike del sup sub kbd ] . freeze
91-
9288 def initialize
9389 super
94- self . tags = ALLOWED_TAGS
95- self . attributes = ALLOWED_ATTRS
90+
91+ attrs = [ ]
92+ tags = [ ]
93+
94+ allowed_types = SiteSetting [ 'AllowedPostTitleFormattingTypes' ]
95+ tags . push ( 'del' , 'strike' ) if allowed_types . include? ( 'strikethrough' )
96+ tags << 'code' if allowed_types . include? ( 'code' )
97+ tags << 'kbd' if allowed_types . include? ( 'keyboard' )
98+ tags << 'em' if allowed_types . include? ( 'italic' )
99+ tags << 'strong' if allowed_types . include? ( 'bold' )
100+ tags << 'sub' if allowed_types . include? ( 'subscript' )
101+ tags << 'sup' if allowed_types . include? ( 'superscript' )
102+
103+ self . tags = tags
104+ self . attributes = attrs
96105 end
97106
98107 def skip_node? ( node )
Original file line number Diff line number Diff line change 784784 - code
785785 - italic
786786 - keyboard
787+ - strikethrough
787788 - subscript
788789 - superscript
789790 value_type : array
You can’t perform that action at this time.
0 commit comments