Merge branch 'kb_development' into kb_migration
This commit is contained in:
commit
4c975d32a1
14 changed files with 47 additions and 34 deletions
|
@ -7,7 +7,7 @@ export function initBoostModal(props) {
|
|||
return (dispatch, getState) => {
|
||||
const default_privacy = getState().getIn(['compose', 'default_privacy']);
|
||||
|
||||
const privacy = props.status.get('visibility') === 'private' ? 'private' : default_privacy;
|
||||
const privacy = props.status.get('visibility_ex') === 'private' ? 'private' : default_privacy;
|
||||
|
||||
dispatch({
|
||||
type: BOOSTS_INIT_MODAL,
|
||||
|
|
|
@ -221,11 +221,11 @@ export function submitCompose(routerHistory) {
|
|||
dispatch(importFetchedStatus({ ...response.data }));
|
||||
}
|
||||
|
||||
if (statusId === null && response.data.visibility !== 'direct') {
|
||||
if (statusId === null && response.data.visibility_ex !== 'direct') {
|
||||
insertIfOnline('home');
|
||||
}
|
||||
|
||||
if (statusId === null && response.data.in_reply_to_id === null && response.data.visibility === 'public') {
|
||||
if (statusId === null && response.data.in_reply_to_id === null && response.data.visibility_ex === 'public') {
|
||||
insertIfOnline('community');
|
||||
insertIfOnline('public');
|
||||
insertIfOnline(`account:${response.data.account.id}`);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import escapeTextContentForBrowser from 'escape-html';
|
||||
import emojify from '../../features/emoji/emoji';
|
||||
import { unescapeHTML } from '../../utils/html';
|
||||
import { expandSpoilers } from '../../initial_state';
|
||||
import { expandSpoilers, me } from '../../initial_state';
|
||||
|
||||
const domParser = new DOMParser();
|
||||
|
||||
|
@ -66,8 +66,8 @@ export function normalizeStatus(status, normalOldStatus) {
|
|||
normalStatus.filtered = status.filtered.map(normalizeFilterResult);
|
||||
}
|
||||
|
||||
if (status.emoji_reactions) {
|
||||
normalStatus.emojiReactions = status.emoji_reactions;
|
||||
if (status.emoji_reactions && normalOldStatus) {
|
||||
normalStatus.emoji_reactions = normalizeEmojiReactions(normalOldStatus.get('emoji_reactions').toArray());
|
||||
}
|
||||
|
||||
// Only calculate these values when status first encountered and
|
||||
|
@ -100,6 +100,17 @@ export function normalizeStatus(status, normalOldStatus) {
|
|||
return normalStatus;
|
||||
}
|
||||
|
||||
export function normalizeEmojiReactions(emoji_reactions) {
|
||||
const myAccountId = me;
|
||||
let converted = [];
|
||||
for (let emoji_reaction of emoji_reactions) {
|
||||
let obj = emoji_reaction.toObject();
|
||||
obj.me = obj.account_ids.toArray().some((id) => id === myAccountId);
|
||||
converted.push(obj);
|
||||
}
|
||||
return converted;
|
||||
}
|
||||
|
||||
export function normalizePoll(poll) {
|
||||
const normalPoll = { ...poll };
|
||||
const emojiMap = makeEmojiMap(normalPoll);
|
||||
|
|
|
@ -518,7 +518,7 @@ class Status extends ImmutablePureComponent {
|
|||
'direct': { icon: 'at', text: intl.formatMessage(messages.direct_short) },
|
||||
};
|
||||
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility')];
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility_ex')];
|
||||
|
||||
let emojiReactionsBar = null;
|
||||
if (!this.props.withoutEmojiReactions && status.get('emoji_reactions')) {
|
||||
|
@ -530,10 +530,10 @@ class Status extends ImmutablePureComponent {
|
|||
|
||||
return (
|
||||
<HotKeys handlers={handlers}>
|
||||
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef}>
|
||||
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility_ex')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef}>
|
||||
{prepend}
|
||||
|
||||
<div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), muted: this.props.muted })} data-id={status.get('id')}>
|
||||
<div className={classNames('status', `status-${status.get('visibility_ex')}`, { 'status-reply': !!status.get('in_reply_to_id'), muted: this.props.muted })} data-id={status.get('id')}>
|
||||
<div onClick={this.handleClick} className='status__info'>
|
||||
<a href={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} className='status__relative-time' target='_blank' rel='noopener noreferrer'>
|
||||
<span className='status__visibility-icon'><Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></span>
|
||||
|
|
|
@ -249,8 +249,8 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
const { signedIn, permissions } = this.context.identity;
|
||||
|
||||
const anonymousAccess = !signedIn;
|
||||
const publicStatus = ['public', 'unlisted', 'public_unlisted'].includes(status.get('visibility'));
|
||||
const pinnableStatus = ['public', 'unlisted', 'public_unlisted', 'private'].includes(status.get('visibility'));
|
||||
const publicStatus = ['public', 'unlisted', 'public_unlisted'].includes(status.get('visibility_ex'));
|
||||
const pinnableStatus = ['public', 'unlisted', 'public_unlisted', 'private'].includes(status.get('visibility_ex'));
|
||||
const mutingConversation = status.get('muted');
|
||||
const account = status.get('account');
|
||||
const writtenByMe = status.getIn(['account', 'id']) === me;
|
||||
|
@ -349,7 +349,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
replyTitle = intl.formatMessage(messages.replyAll);
|
||||
}
|
||||
|
||||
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';
|
||||
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility_ex') === 'private';
|
||||
|
||||
let reblogTitle = '';
|
||||
if (status.get('reblogged')) {
|
||||
|
|
|
@ -152,8 +152,8 @@ class Footer extends ImmutablePureComponent {
|
|||
render () {
|
||||
const { status, intl, withOpenButton } = this.props;
|
||||
|
||||
const publicStatus = ['public', 'unlisted', 'public_unlisted'].includes(status.get('visibility'));
|
||||
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';
|
||||
const publicStatus = ['public', 'unlisted', 'public_unlisted'].includes(status.get('visibility_ex'));
|
||||
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility_ex') === 'private';
|
||||
|
||||
let replyIcon, replyTitle;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class StatusCheckBox extends React.PureComponent {
|
|||
'direct': { icon: 'at', text: intl.formatMessage(messages.direct_short) },
|
||||
};
|
||||
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility')];
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility_ex')];
|
||||
|
||||
const labelComponent = (
|
||||
<div className='status-check-box__status poll__option__text'>
|
||||
|
|
|
@ -190,8 +190,8 @@ class ActionBar extends React.PureComponent {
|
|||
const { status, relationship, intl } = this.props;
|
||||
const { signedIn, permissions } = this.context.identity;
|
||||
|
||||
const publicStatus = ['public', 'unlisted', 'public_unlisted'].includes(status.get('visibility'));
|
||||
const pinnableStatus = ['public', 'unlisted', 'public_unlisted', 'private'].includes(status.get('visibility'));
|
||||
const publicStatus = ['public', 'unlisted', 'public_unlisted'].includes(status.get('visibility_ex'));
|
||||
const pinnableStatus = ['public', 'unlisted', 'public_unlisted', 'private'].includes(status.get('visibility_ex'));
|
||||
const mutingConversation = status.get('muted');
|
||||
const account = status.get('account');
|
||||
const writtenByMe = status.getIn(['account', 'id']) === me;
|
||||
|
@ -278,7 +278,7 @@ class ActionBar extends React.PureComponent {
|
|||
replyIcon = 'reply-all';
|
||||
}
|
||||
|
||||
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';
|
||||
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility_ex') === 'private';
|
||||
|
||||
let reblogTitle;
|
||||
if (status.get('reblogged')) {
|
||||
|
|
|
@ -218,7 +218,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
'direct': { icon: 'at', text: intl.formatMessage(messages.direct_short) },
|
||||
};
|
||||
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility')];
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility_ex')];
|
||||
const visibilityLink = <React.Fragment> · <Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></React.Fragment>;
|
||||
|
||||
const searchabilityIconInfo = {
|
||||
|
@ -231,7 +231,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
const searchabilityIcon = searchabilityIconInfo[status.get('searchability')];
|
||||
const searchabilityLink = <React.Fragment> · <Icon id={searchabilityIcon.icon} title={searchabilityIcon.text} /></React.Fragment>;
|
||||
|
||||
if (['private', 'direct'].includes(status.get('visibility'))) {
|
||||
if (['private', 'direct'].includes(status.get('visibility_ex'))) {
|
||||
reblogLink = '';
|
||||
} else if (this.context.router) {
|
||||
reblogLink = (
|
||||
|
@ -307,7 +307,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
return (
|
||||
<div style={outerStyle}>
|
||||
<div ref={this.setRef} className={classNames('detailed-status', { compact })}>
|
||||
{status.get('visibility') === 'direct' && (
|
||||
{status.get('visibility_ex') === 'direct' && (
|
||||
<div className='status__prepend'>
|
||||
<div className='status__prepend-icon-wrapper'><Icon id='at' className='status__prepend-icon' fixedWidth /></div>
|
||||
<FormattedMessage id='status.direct_indicator' defaultMessage='Private mention' />
|
||||
|
|
|
@ -91,12 +91,12 @@ class BoostModal extends ImmutablePureComponent {
|
|||
'direct': { icon: 'at', text: intl.formatMessage(messages.direct_short) },
|
||||
};
|
||||
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility')];
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility_ex')];
|
||||
|
||||
return (
|
||||
<div className='modal-root__modal boost-modal'>
|
||||
<div className='boost-modal__container'>
|
||||
<div className={classNames('status', `status-${status.get('visibility')}`, 'light')}>
|
||||
<div className={classNames('status', `status-${status.get('visibility_ex')}`, 'light')}>
|
||||
<div className='status__info'>
|
||||
<a href={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} className='status__relative-time' target='_blank' rel='noopener noreferrer'>
|
||||
<span className='status__visibility-icon'><Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></span>
|
||||
|
@ -125,7 +125,7 @@ class BoostModal extends ImmutablePureComponent {
|
|||
|
||||
<div className='boost-modal__action-bar'>
|
||||
<div><FormattedMessage id='boost_modal.combo' defaultMessage='You can press {combo} to skip this next time' values={{ combo: <span>Shift + <Icon id='retweet' /></span> }} /></div>
|
||||
{status.get('visibility') !== 'private' && !status.get('reblogged') && (
|
||||
{status.get('visibility_ex') !== 'private' && !status.get('reblogged') && (
|
||||
<PrivacyDropdown
|
||||
noDirect
|
||||
value={privacy}
|
||||
|
|
|
@ -347,7 +347,7 @@ export default function compose(state = initialState, action) {
|
|||
map.set('id', null);
|
||||
map.set('in_reply_to', action.status.get('id'));
|
||||
map.set('text', statusToTextMentions(state, action.status));
|
||||
map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
|
||||
map.set('privacy', privacyPreference(action.status.get('visibility_ex'), state.get('default_privacy')));
|
||||
map.set('searchability', privacyPreference(action.status.get('searchability'), state.get('default_searchability')));
|
||||
map.set('focusDate', new Date());
|
||||
map.set('caretPosition', null);
|
||||
|
@ -481,7 +481,7 @@ export default function compose(state = initialState, action) {
|
|||
return state.withMutations(map => {
|
||||
map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status)));
|
||||
map.set('in_reply_to', action.status.get('in_reply_to_id'));
|
||||
map.set('privacy', action.status.get('visibility'));
|
||||
map.set('privacy', action.status.get('visibility_ex'));
|
||||
map.set('media_attachments', action.status.get('media_attachments').map((media) => media.set('unattached', true)));
|
||||
map.set('focusDate', new Date());
|
||||
map.set('caretPosition', null);
|
||||
|
@ -511,7 +511,7 @@ export default function compose(state = initialState, action) {
|
|||
map.set('id', action.status.get('id'));
|
||||
map.set('text', action.text);
|
||||
map.set('in_reply_to', action.status.get('in_reply_to_id'));
|
||||
map.set('privacy', action.status.get('visibility'));
|
||||
map.set('privacy', action.status.get('visibility_ex'));
|
||||
map.set('media_attachments', action.status.get('media_attachments'));
|
||||
map.set('focusDate', new Date());
|
||||
map.set('caretPosition', null);
|
||||
|
|
|
@ -29,7 +29,6 @@ class PublicFeed
|
|||
scope.merge!(account_filters_scope) if account?
|
||||
scope.merge!(media_only_scope) if media_only?
|
||||
scope.merge!(language_scope) if account&.chosen_languages.present?
|
||||
scope.merge!(public_searchable_scope) if local_only? && !account?
|
||||
|
||||
scope.cache_ids.to_a_paginated_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
|
||||
end
|
||||
|
@ -63,7 +62,7 @@ class PublicFeed
|
|||
end
|
||||
|
||||
def media_only?
|
||||
options[:only_media]
|
||||
!local_only? && options[:only_media]
|
||||
end
|
||||
|
||||
def public_scope
|
||||
|
@ -98,10 +97,6 @@ class PublicFeed
|
|||
Status.where(language: account.chosen_languages)
|
||||
end
|
||||
|
||||
def public_searchable_scope
|
||||
Status.where(searchability: 'public').or(Status.where(searchability: nil).merge(Account.where(searchability: 'public')))
|
||||
end
|
||||
|
||||
def account_filters_scope
|
||||
Status.not_excluded_by_account(account).tap do |scope|
|
||||
scope.merge!(Status.not_domain_blocked_by_account(account)) unless local_only?
|
||||
|
|
|
@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||
include FormattingHelper
|
||||
|
||||
attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
|
||||
:sensitive, :spoiler_text, :visibility, :language,
|
||||
:sensitive, :spoiler_text, :visibility, :visibility_ex, :language,
|
||||
:uri, :url, :replies_count, :reblogs_count, :searchability,
|
||||
:favourites_count, :emoji_reactions, :edited_at
|
||||
|
||||
|
@ -56,11 +56,17 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||
# UX differences
|
||||
if object.limited_visibility?
|
||||
'private'
|
||||
elsif object.public_unlisted_visibility?
|
||||
'public'
|
||||
else
|
||||
object.visibility
|
||||
end
|
||||
end
|
||||
|
||||
def visibility_ex
|
||||
object.visibility
|
||||
end
|
||||
|
||||
def searchability
|
||||
object.compute_searchability
|
||||
end
|
||||
|
|
|
@ -77,6 +77,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
@account.suspended_at = domain_block.created_at if auto_suspend?
|
||||
@account.suspension_origin = :local if auto_suspend?
|
||||
@account.silenced_at = domain_block.created_at if auto_silence?
|
||||
@account.searchability = :private # not null
|
||||
@account.save
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue