Skip to content

Commit 0130787

Browse files
authored
Change buttons on timeline preview to open the interaction dialog (mastodon#10054)
Fix mastodon#9922
1 parent 7e6d5ae commit 0130787

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

app/javascript/mastodon/components/status_action_bar.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ class StatusActionBar extends ImmutablePureComponent {
7878
]
7979

8080
handleReplyClick = () => {
81-
this.props.onReply(this.props.status, this.context.router.history);
81+
if (me) {
82+
this.props.onReply(this.props.status, this.context.router.history);
83+
} else {
84+
this._openInteractionDialog('reply');
85+
}
8286
}
8387

8488
handleShareClick = () => {
@@ -91,11 +95,23 @@ class StatusActionBar extends ImmutablePureComponent {
9195
}
9296

9397
handleFavouriteClick = () => {
94-
this.props.onFavourite(this.props.status);
98+
if (me) {
99+
this.props.onFavourite(this.props.status);
100+
} else {
101+
this._openInteractionDialog('favourite');
102+
}
103+
}
104+
105+
handleReblogClick = e => {
106+
if (me) {
107+
this.props.onReblog(this.props.status, e);
108+
} else {
109+
this._openInteractionDialog('reblog');
110+
}
95111
}
96112

97-
handleReblogClick = (e) => {
98-
this.props.onReblog(this.props.status, e);
113+
_openInteractionDialog = type => {
114+
window.open(`/interact/${this.props.status.get('id')}?type=${type}`, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes');
99115
}
100116

101117
handleDeleteClick = () => {
@@ -233,9 +249,9 @@ class StatusActionBar extends ImmutablePureComponent {
233249

234250
return (
235251
<div className='status__action-bar'>
236-
<div className='status__action-bar__counter'><IconButton className='status__action-bar-button' disabled={anonymousAccess} title={replyTitle} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /><span className='status__action-bar__counter__label' >{obfuscatedCount(status.get('replies_count'))}</span></div>
237-
<IconButton className='status__action-bar-button' disabled={anonymousAccess || !publicStatus} active={status.get('reblogged')} pressed={status.get('reblogged')} title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)} icon={reblogIcon} onClick={this.handleReblogClick} />
238-
<IconButton className='status__action-bar-button star-icon' disabled={anonymousAccess} animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />
252+
<div className='status__action-bar__counter'><IconButton className='status__action-bar-button' title={replyTitle} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /><span className='status__action-bar__counter__label' >{obfuscatedCount(status.get('replies_count'))}</span></div>
253+
<IconButton className='status__action-bar-button' disabled={!publicStatus} active={status.get('reblogged')} pressed={status.get('reblogged')} title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)} icon={reblogIcon} onClick={this.handleReblogClick} />
254+
<IconButton className='status__action-bar-button star-icon' animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />
239255
{shareButton}
240256

241257
<div className='status__action-bar-dropdown'>

0 commit comments

Comments
 (0)