diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx
index 7670ee8ac6..7d598ef17b 100644
--- a/app/javascript/mastodon/components/status.jsx
+++ b/app/javascript/mastodon/components/status.jsx
@@ -515,7 +515,9 @@ class Status extends ImmutablePureComponent {
let emojiReactionsBar = null;
if (!this.props.withoutEmojiReactions && status.get('emoji_reactions')) {
const emojiReactions = status.get('emoji_reactions');
- emojiReactionsBar = ;
+ if (emojiReactions.size > 0) {
+ emojiReactionsBar = ;
+ }
}
return (
diff --git a/app/javascript/mastodon/features/notifications/components/filter_bar.jsx b/app/javascript/mastodon/features/notifications/components/filter_bar.jsx
index f56ca6a69c..9fb06c1ddc 100644
--- a/app/javascript/mastodon/features/notifications/components/filter_bar.jsx
+++ b/app/javascript/mastodon/features/notifications/components/filter_bar.jsx
@@ -6,6 +6,7 @@ import Icon from 'mastodon/components/icon';
const tooltips = defineMessages({
mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' },
favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favourites' },
+ emojiReactions: { id: 'notifications.filter.emoji_reactions', defaultMessage: 'Emoji reactions' },
boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Boosts' },
polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' },
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
@@ -79,7 +80,7 @@ class FilterBar extends React.PureComponent {
onClick={this.onClick('emoji_reaction')}
title={intl.formatMessage(tooltips.emojiReactions)}
>
-
+
;
+ if (emojiReactions.size > 0) {
+ emojiReactionsBar = ;
+ }
}
if (status.get('application')) {
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss
index 4364b8ebd6..538044340c 100644
--- a/app/javascript/styles/mastodon/components.scss
+++ b/app/javascript/styles/mastodon/components.scss
@@ -1269,7 +1269,7 @@ body > [data-popper-placement] {
margin: 8px 0 2px 4px;
.emoji-reactions-bar__button {
- background: lighten($ui-base-color, 16%);
+ background: lighten($ui-base-color, 12%);
border: 0;
cursor: pointer;
display: flex;
diff --git a/app/javascript/styles/mastodon/rich_text.scss b/app/javascript/styles/mastodon/rich_text.scss
index 35901984b4..0d70eced55 100644
--- a/app/javascript/styles/mastodon/rich_text.scss
+++ b/app/javascript/styles/mastodon/rich_text.scss
@@ -1,3 +1,4 @@
+.account__header__bio,
.status__content__text,
.e-content,
.reply-indicator__content {
@@ -12,6 +13,32 @@
}
}
+ code, pre {
+ border: 1px solid $ui-primary-color;
+ font-family: monospace;
+ }
+
+ code {
+ margin: 0 4px;
+ }
+
+ pre {
+ padding: 4px 8px;
+
+ span.ellipsis::after {
+ content: "";
+ }
+
+ span.invisible {
+ display: inline;
+ font-size: inherit;
+ line-height: inherit;
+ width: inherit;
+ height: inherit;
+ position: static;
+ }
+ }
+
blockquote {
padding-left: 10px;
border-left: 3px solid $darker-text-color;
diff --git a/app/lib/text_formatter.rb b/app/lib/text_formatter.rb
index 48e2fc2338..607583ab2f 100644
--- a/app/lib/text_formatter.rb
+++ b/app/lib/text_formatter.rb
@@ -43,7 +43,13 @@ class TextFormatter
end
end
- html = simple_format(html, {}, sanitize: false).delete("\n") if multiline?
+ # line first letter for blockquote
+ p 'DEBUG ' + html.gsub(/^gt;/, '>')
+ html = markdownify(html.gsub(/^>/, '>'))
+
+ # html = simple_format(html, {}, sanitize: false).delete("\n") if multiline?
+ html = html.delete("\n")
+ p html
html.html_safe # rubocop:disable Rails/OutputSafety
end
@@ -155,4 +161,45 @@ class TextFormatter
def preloaded_accounts?
preloaded_accounts.present?
end
+
+ def markdownify(html)
+ # not need filter_html because escape is already done
+ @htmlobj ||= MyMarkdownHTML.new(
+ filter_html: false,
+ hard_wrap: true
+ )
+ @markdown ||= Redcarpet::Markdown.new(@htmlobj,
+ autolink: false,
+ tables: false,
+ underline: true,
+ disable_indented_code_blocks: false,
+ fenced_code_blocks: true,
+ highlight: false
+ )
+ @markdown.render(html)
+ end
+
+ class MyMarkdownHTML < Redcarpet::Render::HTML
+ def link(link, title, content)
+ nil
+ end
+
+ def block_code(code, language)
+ "
#{process_program_code(code)}
"
+ end
+
+ def codespan(code)
+ "#{process_program_code(code)}
"
+ end
+
+ def header(text, header_level)
+ "#{text}
"
+ end
+
+ private
+
+ def process_program_code(code)
+ code.gsub(/\n/, '
')
+ end
+ end
end