From 5622de4a785e6b7c9a4946af3efaf8b4c2bc5755 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sun, 23 Aug 2020 09:38:27 -0500 Subject: [Feature] Support Misskey-compatible boosts with attached content notes --- .../flavours/glitch/components/status.js | 2 +- .../flavours/glitch/components/status_content.js | 38 ++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) (limited to 'app/javascript/flavours/glitch/components') diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js index a94142452..69f93a2f1 100644 --- a/app/javascript/flavours/glitch/components/status.js +++ b/app/javascript/flavours/glitch/components/status.js @@ -370,7 +370,7 @@ class Status extends ImmutablePureComponent { } handleExpandedToggle = () => { - if (this.props.status.get('spoiler_text')) { + if (this.props.status.get('spoiler_text') || this.props.status.get('reblogSpoilerHtml')) { this.setExpansion(!this.state.isExpanded); } }; diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index 40413b07b..e0a759499 100644 --- a/app/javascript/flavours/glitch/components/status_content.js +++ b/app/javascript/flavours/glitch/components/status_content.js @@ -422,19 +422,35 @@ export default class StatusContent extends React.PureComponent { ); + const reblog_spoiler_html = status.get('reblogSpoilerPresent') && { __html: status.get('reblogSpoilerHtml') }; + const reblog_spoiler = reblog_spoiler_html && ( +
+ + +
+ ); + + const spoiler_html = status.get('spoiler_text').length > 0 && { __html: status.get('spoilerHtml') }; + const spoiler = spoiler_html && ( +
+ + +
+ ); + + const spoiler_present = status.get('spoiler_text').length > 0 || status.get('reblogSpoilerPresent'); const content = { __html: article ? status.get('articleHtml') : status.get('contentHtml') }; - const spoilerContent = { __html: status.get('spoilerHtml') }; const directionStyle = { direction: 'ltr' }; const classNames = classnames('status__content', { 'status__content--with-action': parseClick && !disabled, - 'status__content--with-spoiler': status.get('spoiler_text').length > 0, + 'status__content--with-spoiler': spoiler_present, }); if (isRtl(status.get('search_index'))) { directionStyle.direction = 'rtl'; } - if (status.get('spoiler_text').length > 0) { + if (spoiler_present) { let mentionsPlaceholder = ''; const mentionLinks = status.get('mentions').map(item => ( @@ -486,15 +502,17 @@ export default class StatusContent extends React.PureComponent { return (
{status_notice_wrapper} - + {reblog_spoiler} + {spoiler} +
+ +
+
{mentionsPlaceholder} -- cgit