diff --git a/app/assets/javascripts/discourse/templates/user-card.hbs b/app/assets/javascripts/discourse/templates/user-card.hbs index dc4b23258..d7d9fbe44 100644 --- a/app/assets/javascripts/discourse/templates/user-card.hbs +++ b/app/assets/javascripts/discourse/templates/user-card.hbs @@ -47,7 +47,7 @@ {{i18n 'user.suspended_reason'}} {{user.suspend_reason}} {{else}} - {{#if user.bio_cooked}}
{{text-overflow class="overflow" text=user.bio_cooked}}
{{/if}} + {{#if user.bio_cooked}}
{{text-overflow class="overflow" text=user.bio_excerpt}}
{{/if}} {{/if}} {{#if user.card_badge}} diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index f9ba6563b..737b1f39e 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -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? diff --git a/lib/excerpt_parser.rb b/lib/excerpt_parser.rb index bb2606a1a..f36fd0150 100644 --- a/lib/excerpt_parser.rb +++ b/lib/excerpt_parser.rb @@ -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("
", false, false, false) + else + characters(" ") + end when "aside" @in_quote = false when "div", "span"