Merge branch 'remote_follow' into 'develop'
Remote follow See merge request soapbox-pub/soapbox-fe!436
This commit is contained in:
commit
da7e6cc17e
4 changed files with 42 additions and 22 deletions
|
@ -292,19 +292,16 @@ class Header extends ImmutablePureComponent {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
<div className='account__header__extra__buttons'>
|
||||||
me &&
|
<ActionButton account={account} />
|
||||||
<div className='account__header__extra__buttons'>
|
{me && account.get('id') !== me && account.getIn(['pleroma', 'accepts_chat_messages'], false) === true &&
|
||||||
<ActionButton account={account} />
|
<Button className='button-alternative-2' onClick={this.props.onChat}>
|
||||||
{account.get('id') !== me && account.getIn(['pleroma', 'accepts_chat_messages'], false) === true &&
|
<Icon id='comment' />
|
||||||
<Button className='button-alternative-2' onClick={this.props.onChat}>
|
<FormattedMessage id='account.message' defaultMessage='Message' />
|
||||||
<Icon id='comment' />
|
</Button>
|
||||||
<FormattedMessage id='account.message' defaultMessage='Message' />
|
}
|
||||||
</Button>
|
{me && <DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' />}
|
||||||
}
|
</div>
|
||||||
<DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' />
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
|
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
|
||||||
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
||||||
|
remote_follow: { id: 'account.remote_follow', defaultMessage: 'Remote follow' },
|
||||||
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
|
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
|
||||||
requested_small: { id: 'account.requested_small', defaultMessage: 'Awaiting approval' },
|
requested_small: { id: 'account.requested_small', defaultMessage: 'Awaiting approval' },
|
||||||
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
|
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
|
||||||
|
@ -81,24 +82,42 @@ class ActionButton extends ImmutablePureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { account, intl, me, small } = this.props;
|
const { account, intl, me, small } = this.props;
|
||||||
let actionBtn = null;
|
const empty = <></>;
|
||||||
|
|
||||||
if (!account || !me) return actionBtn;
|
if (!me) {
|
||||||
|
// Remote follow
|
||||||
|
return (<form method='POST' action='/main/ostatus'>
|
||||||
|
<input type='hidden' name='nickname' value={account.get('username')} />
|
||||||
|
<input type='hidden' name='profile' value='' />
|
||||||
|
<Button className='logo-button' text={intl.formatMessage(messages.remote_follow)} click='submit' />
|
||||||
|
</form>);
|
||||||
|
}
|
||||||
|
|
||||||
if (me !== account.get('id')) {
|
if (me !== account.get('id')) {
|
||||||
if (!account.get('relationship')) { // Wait until the relationship is loaded
|
if (!account.get('relationship')) { // Wait until the relationship is loaded
|
||||||
//
|
return empty;
|
||||||
} else if (account.getIn(['relationship', 'requested'])) {
|
} else if (account.getIn(['relationship', 'requested'])) {
|
||||||
actionBtn = <Button className='logo-button' text={small ? intl.formatMessage(messages.requested_small) : intl.formatMessage(messages.requested)} onClick={this.handleFollow} />;
|
// Awaiting acceptance
|
||||||
|
return <Button className='logo-button' text={small ? intl.formatMessage(messages.requested_small) : intl.formatMessage(messages.requested)} onClick={this.handleFollow} />;
|
||||||
} else if (!account.getIn(['relationship', 'blocking'])) {
|
} else if (!account.getIn(['relationship', 'blocking'])) {
|
||||||
actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames('logo-button', { 'button--destructive': account.getIn(['relationship', 'following']) })} text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={this.handleFollow} />;
|
// Follow & Unfollow
|
||||||
|
return (<Button
|
||||||
|
disabled={account.getIn(['relationship', 'blocked_by'])}
|
||||||
|
className={classNames('logo-button', {
|
||||||
|
'button--destructive': account.getIn(['relationship', 'following']),
|
||||||
|
})}
|
||||||
|
text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)}
|
||||||
|
onClick={this.handleFollow}
|
||||||
|
/>);
|
||||||
} else if (account.getIn(['relationship', 'blocking'])) {
|
} else if (account.getIn(['relationship', 'blocking'])) {
|
||||||
actionBtn = <Button className='logo-button' text={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />;
|
// Unblock
|
||||||
|
return <Button className='logo-button' text={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
actionBtn = <Button className='logo-button' text={intl.formatMessage(messages.edit_profile)} to='/settings/profile' />;
|
// Edit profile
|
||||||
|
return <Button className='logo-button' text={intl.formatMessage(messages.edit_profile)} to='/settings/profile' />;
|
||||||
}
|
}
|
||||||
return actionBtn;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,9 @@ self.addEventListener('fetch', function(event) {
|
||||||
url.pathname.startsWith('/avatars') ||
|
url.pathname.startsWith('/avatars') ||
|
||||||
url.pathname.startsWith('/authorize_follow') ||
|
url.pathname.startsWith('/authorize_follow') ||
|
||||||
url.pathname.startsWith('/media_proxy') ||
|
url.pathname.startsWith('/media_proxy') ||
|
||||||
url.pathname.startsWith('/relationships')) {
|
url.pathname.startsWith('/relationships') ||
|
||||||
|
url.pathname.startsWith('/main/ostatus') ||
|
||||||
|
url.pathname.startsWith('/ostatus_subscribe')) {
|
||||||
//non-webapp routes
|
//non-webapp routes
|
||||||
} else if (url.pathname.startsWith('/')) {
|
} else if (url.pathname.startsWith('/')) {
|
||||||
// : TODO : if is /web
|
// : TODO : if is /web
|
||||||
|
|
|
@ -22,6 +22,8 @@ const backendEndpoints = [
|
||||||
'/.well-known/webfinger',
|
'/.well-known/webfinger',
|
||||||
'/static',
|
'/static',
|
||||||
'/emoji',
|
'/emoji',
|
||||||
|
'/main/ostatus',
|
||||||
|
'/ostatus_subscribe',
|
||||||
];
|
];
|
||||||
|
|
||||||
const makeProxyConfig = () => {
|
const makeProxyConfig = () => {
|
||||||
|
|
Loading…
Reference in a new issue