mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-30 02:23:47 +00:00
Fix display of toots without text content (#15665)
* Fix display of toots without text content - fixes CWs from other implementations not showing up if toot has no text contents - fixes the “Read more” thread indicator not showing up on threaded toots with no text contents * Move content-less toot's CW to conents
This commit is contained in:
parent
7cb34b32f8
commit
aa1b43f467
|
@ -62,6 +62,13 @@ export function normalizeStatus(status, normalOldStatus) {
|
||||||
normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
|
normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
|
||||||
normalStatus.hidden = normalOldStatus.get('hidden');
|
normalStatus.hidden = normalOldStatus.get('hidden');
|
||||||
} else {
|
} else {
|
||||||
|
// If the status has a CW but no contents, treat the CW as if it were the
|
||||||
|
// status' contents, to avoid having a CW toggle with seemingly no effect.
|
||||||
|
if (normalStatus.spoiler_text && !normalStatus.content) {
|
||||||
|
normalStatus.content = normalStatus.spoiler_text;
|
||||||
|
normalStatus.spoiler_text = '';
|
||||||
|
}
|
||||||
|
|
||||||
const spoilerText = normalStatus.spoiler_text || '';
|
const spoilerText = normalStatus.spoiler_text || '';
|
||||||
const searchContent = ([spoilerText, status.content].concat((status.poll && status.poll.options) ? status.poll.options.map(option => option.title) : [])).join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
|
const searchContent = ([spoilerText, status.content].concat((status.poll && status.poll.options) ? status.poll.options.map(option => option.title) : [])).join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
|
||||||
const emojiMap = makeEmojiMap(normalStatus);
|
const emojiMap = makeEmojiMap(normalStatus);
|
||||||
|
|
|
@ -170,10 +170,6 @@ export default class StatusContent extends React.PureComponent {
|
||||||
render () {
|
render () {
|
||||||
const { status } = this.props;
|
const { status } = this.props;
|
||||||
|
|
||||||
if (status.get('content').length === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden;
|
const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden;
|
||||||
const renderReadMore = this.props.onClick && status.get('collapsed');
|
const renderReadMore = this.props.onClick && status.get('collapsed');
|
||||||
const renderViewThread = this.props.showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']);
|
const renderViewThread = this.props.showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']);
|
||||||
|
|
Loading…
Reference in a new issue