mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
FIX: clean html before sending it to jquery for collapsing
This commit is contained in:
parent
8be746b285
commit
8013b6a511
|
@ -47,7 +47,7 @@
|
|||
<b>{{i18n 'user.suspended_reason'}}</b> {{user.suspend_reason}}
|
||||
</div>
|
||||
{{else}}
|
||||
{{#if user.bio_cooked}}<div class='bio'>{{text-overflow class="overflow" text=user.bio_cooked}}</div>{{/if}}
|
||||
{{#if user.bio_cooked}}<div class='bio'>{{text-overflow class="overflow" text=user.bio_excerpt}}</div>{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if user.card_badge}}
|
||||
|
|
|
@ -196,16 +196,7 @@ class UserSerializer < BasicUserSerializer
|
|||
end
|
||||
|
||||
def bio_excerpt
|
||||
# If they have a bio return it
|
||||
excerpt = object.user_profile.bio_excerpt
|
||||
return excerpt if excerpt.present?
|
||||
|
||||
# Without a bio, determine what message to show
|
||||
if scope.user && scope.user.id == object.id
|
||||
I18n.t('user_profile.no_info_me', username_lower: object.username_lower)
|
||||
else
|
||||
I18n.t('user_profile.no_info_other', name: object.name)
|
||||
end
|
||||
object.user_profile.bio_excerpt(350 ,keep_newlines: true)
|
||||
end
|
||||
|
||||
def include_suspend_reason?
|
||||
|
|
|
@ -12,6 +12,7 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
|||
@strip_links = options[:strip_links] == true
|
||||
@text_entities = options[:text_entities] == true
|
||||
@markdown_images = options[:markdown_images] == true
|
||||
@keep_newlines = options[:keep_newlines] == true
|
||||
@start_excerpt = false
|
||||
end
|
||||
|
||||
|
@ -92,7 +93,11 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
|||
@in_a = false
|
||||
end
|
||||
when "p", "br"
|
||||
characters(" ")
|
||||
if @keep_newlines
|
||||
characters("<br>", false, false, false)
|
||||
else
|
||||
characters(" ")
|
||||
end
|
||||
when "aside"
|
||||
@in_quote = false
|
||||
when "div", "span"
|
||||
|
|
Loading…
Reference in New Issue
Block a user