[Glitch] Add support for private pinned posts

Port JS changes from d5c9feb7b7 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/1661/head
Claire 2022-01-17 00:49:55 +01:00
parent 2d4b4b0b45
commit 5effc0f8fa
2 changed files with 4 additions and 2 deletions

View File

@ -196,6 +196,7 @@ class StatusActionBar extends ImmutablePureComponent {
const anonymousAccess = !me; const anonymousAccess = !me;
const mutingConversation = status.get('muted'); const mutingConversation = status.get('muted');
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
const pinnableStatus = ['public', 'unlisted', 'private'].includes(status.get('visibility'));
const writtenByMe = status.getIn(['account', 'id']) === me; const writtenByMe = status.getIn(['account', 'id']) === me;
let menu = []; let menu = [];
@ -212,7 +213,7 @@ class StatusActionBar extends ImmutablePureComponent {
menu.push(null); menu.push(null);
if (writtenByMe && publicStatus) { if (writtenByMe && pinnableStatus) {
menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick }); menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick });
menu.push(null); menu.push(null);
} }

View File

@ -146,6 +146,7 @@ class ActionBar extends React.PureComponent {
const { status, intl } = this.props; const { status, intl } = this.props;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
const pinnableStatus = ['public', 'unlisted', 'private'].includes(status.get('visibility'));
const mutingConversation = status.get('muted'); const mutingConversation = status.get('muted');
const writtenByMe = status.getIn(['account', 'id']) === me; const writtenByMe = status.getIn(['account', 'id']) === me;
@ -158,7 +159,7 @@ class ActionBar extends React.PureComponent {
} }
if (writtenByMe) { if (writtenByMe) {
if (publicStatus) { if (pinnableStatus) {
menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick }); menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick });
menu.push(null); menu.push(null);
} }