Explicit addressing: remove "Show thread" button, handle StatusReplyMentions edge cases, fixes #793
This commit is contained in:
parent
dc49ef9999
commit
4c66126c01
5 changed files with 42 additions and 32 deletions
|
@ -88,7 +88,6 @@ class Status extends ImmutablePureComponent {
|
||||||
unread: PropTypes.bool,
|
unread: PropTypes.bool,
|
||||||
onMoveUp: PropTypes.func,
|
onMoveUp: PropTypes.func,
|
||||||
onMoveDown: PropTypes.func,
|
onMoveDown: PropTypes.func,
|
||||||
showThread: PropTypes.bool,
|
|
||||||
getScrollPosition: PropTypes.func,
|
getScrollPosition: PropTypes.func,
|
||||||
updateScrollBottom: PropTypes.func,
|
updateScrollBottom: PropTypes.func,
|
||||||
cacheMediaWidth: PropTypes.func,
|
cacheMediaWidth: PropTypes.func,
|
||||||
|
@ -318,7 +317,7 @@ class Status extends ImmutablePureComponent {
|
||||||
const poll = null;
|
const poll = null;
|
||||||
let statusAvatar, prepend, rebloggedByText, reblogContent;
|
let statusAvatar, prepend, rebloggedByText, reblogContent;
|
||||||
|
|
||||||
const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props;
|
const { intl, hidden, featured, otherAccounts, unread, group } = this.props;
|
||||||
|
|
||||||
// FIXME: why does this need to reassign status and account??
|
// FIXME: why does this need to reassign status and account??
|
||||||
let { status, account, ...other } = this.props; // eslint-disable-line prefer-const
|
let { status, account, ...other } = this.props; // eslint-disable-line prefer-const
|
||||||
|
@ -553,12 +552,6 @@ class Status extends ImmutablePureComponent {
|
||||||
{media}
|
{media}
|
||||||
{poll}
|
{poll}
|
||||||
|
|
||||||
{showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && (
|
|
||||||
<button className='status__content__read-more-button' onClick={this.handleClick}>
|
|
||||||
<FormattedMessage id='status.show_thread' defaultMessage='Show thread' />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<StatusActionBar
|
<StatusActionBar
|
||||||
status={status}
|
status={status}
|
||||||
account={account}
|
account={account}
|
||||||
|
|
|
@ -118,7 +118,6 @@ export default class StatusList extends ImmutablePureComponent {
|
||||||
contextType={timelineId}
|
contextType={timelineId}
|
||||||
group={group}
|
group={group}
|
||||||
withGroupAdmin={withGroupAdmin}
|
withGroupAdmin={withGroupAdmin}
|
||||||
showThread
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +137,6 @@ export default class StatusList extends ImmutablePureComponent {
|
||||||
contextType={timelineId}
|
contextType={timelineId}
|
||||||
group={group}
|
group={group}
|
||||||
withGroupAdmin={withGroupAdmin}
|
withGroupAdmin={withGroupAdmin}
|
||||||
showThread
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -157,7 +155,6 @@ export default class StatusList extends ImmutablePureComponent {
|
||||||
onMoveUp={this.handleMoveUp}
|
onMoveUp={this.handleMoveUp}
|
||||||
onMoveDown={this.handleMoveDown}
|
onMoveDown={this.handleMoveDown}
|
||||||
contextType={timelineId}
|
contextType={timelineId}
|
||||||
showThread
|
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,46 @@ class StatusReplyMentions extends ImmutablePureComponent {
|
||||||
render() {
|
render() {
|
||||||
const { status } = this.props;
|
const { status } = this.props;
|
||||||
|
|
||||||
const to = status.get('mentions', []);
|
if (!status.get('in_reply_to_id')) {
|
||||||
|
|
||||||
if (!status.get('in_reply_to_id') || !to || to.size === 0) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const to = status.get('mentions', []);
|
||||||
|
|
||||||
|
// The post is a reply, but it has no mentions.
|
||||||
|
if (to.size === 0) {
|
||||||
|
// The author is replying to themself.
|
||||||
|
if (status.get('in_reply_to_account_id') === status.getIn(['account', 'id'])) {
|
||||||
|
return (
|
||||||
|
<div className='reply-mentions'>
|
||||||
|
<FormattedMessage
|
||||||
|
id='reply_mentions.reply'
|
||||||
|
defaultMessage='Replying to {accounts}{more}'
|
||||||
|
values={{
|
||||||
|
accounts: (<>
|
||||||
|
<HoverRefWrapper accountId={status.getIn(['account', 'id'])} inline>
|
||||||
|
<Link to={`/@${status.getIn(['account', 'acct'])}`} className='reply-mentions__account'>@{status.getIn(['account', 'username'])}</Link>
|
||||||
|
</HoverRefWrapper>
|
||||||
|
</>),
|
||||||
|
more: false,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// The reply-to is unknown. Rare, but it can happen.
|
||||||
|
return (
|
||||||
|
<div className='reply-mentions'>
|
||||||
|
<FormattedMessage
|
||||||
|
id='reply_mentions.reply_empty'
|
||||||
|
defaultMessage='Replying to post'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The typical case with a reply-to and a list of mentions.
|
||||||
return (
|
return (
|
||||||
<div className='reply-mentions'>
|
<div className='reply-mentions'>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
|
@ -29,7 +63,7 @@ class StatusReplyMentions extends ImmutablePureComponent {
|
||||||
values={{
|
values={{
|
||||||
accounts: to.slice(0, 2).map(account => (<>
|
accounts: to.slice(0, 2).map(account => (<>
|
||||||
<HoverRefWrapper accountId={account.get('id')} inline>
|
<HoverRefWrapper accountId={account.get('id')} inline>
|
||||||
<Link to={`/@${account.get('acct')}`} className='reply-mentions__account'>@{account.get('acct').split('@')[0]}</Link>
|
<Link to={`/@${account.get('acct')}`} className='reply-mentions__account'>@{account.get('username')}</Link>
|
||||||
</HoverRefWrapper>
|
</HoverRefWrapper>
|
||||||
{' '}
|
{' '}
|
||||||
</>)),
|
</>)),
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { FormattedMessage } from 'react-intl';
|
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import StatusContent from 'soapbox/components/status_content';
|
import StatusContent from 'soapbox/components/status_content';
|
||||||
import { buildStatus } from '../builder';
|
import { buildStatus } from '../builder';
|
||||||
|
@ -25,7 +24,7 @@ export default @connect(mapStateToProps)
|
||||||
class ScheduledStatus extends ImmutablePureComponent {
|
class ScheduledStatus extends ImmutablePureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { status, showThread, account, ...other } = this.props;
|
const { status, account, ...other } = this.props;
|
||||||
if (!status.get('account')) return null;
|
if (!status.get('account')) return null;
|
||||||
|
|
||||||
const statusUrl = `/scheduled_statuses/${status.get('id')}`;
|
const statusUrl = `/scheduled_statuses/${status.get('id')}`;
|
||||||
|
@ -74,12 +73,6 @@ class ScheduledStatus extends ImmutablePureComponent {
|
||||||
|
|
||||||
{status.get('poll') && <PollPreview poll={status.get('poll')} />}
|
{status.get('poll') && <PollPreview poll={status.get('poll')} />}
|
||||||
|
|
||||||
{showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && (
|
|
||||||
<button className='status__content__read-more-button' onClick={this.handleClick}>
|
|
||||||
<FormattedMessage id='status.show_thread' defaultMessage='Show thread' />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<ScheduledStatusActionBar status={status} account={account} {...other} />
|
<ScheduledStatusActionBar status={status} account={account} {...other} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { FormattedMessage } from 'react-intl';
|
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import StatusContent from 'soapbox/components/status_content';
|
import StatusContent from 'soapbox/components/status_content';
|
||||||
import { buildStatus } from '../util/pending_status_builder';
|
import { buildStatus } from '../util/pending_status_builder';
|
||||||
|
@ -46,7 +45,7 @@ class PendingStatus extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { status, className, showThread } = this.props;
|
const { status, className } = this.props;
|
||||||
if (!status) return null;
|
if (!status) return null;
|
||||||
if (!status.get('account')) return null;
|
if (!status.get('account')) return null;
|
||||||
|
|
||||||
|
@ -91,12 +90,6 @@ class PendingStatus extends ImmutablePureComponent {
|
||||||
{this.renderMedia()}
|
{this.renderMedia()}
|
||||||
{status.get('poll') && <PollPreview poll={status.get('poll')} />}
|
{status.get('poll') && <PollPreview poll={status.get('poll')} />}
|
||||||
|
|
||||||
{showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && (
|
|
||||||
<button className='status__content__read-more-button' onClick={this.handleClick}>
|
|
||||||
<FormattedMessage id='status.show_thread' defaultMessage='Show thread' />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* TODO */}
|
{/* TODO */}
|
||||||
{/* <PlaceholderActionBar /> */}
|
{/* <PlaceholderActionBar /> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue