Merge branch 'blockers_visible_support' into 'develop'

Support the blockers_visible option when it's available

See merge request soapbox-pub/soapbox-fe!991
profile-avatar-switcher
Alex Gleason 2022-01-15 01:33:22 +00:00
commit c13b36fed3
6 zmienionych plików z 17 dodań i 5 usunięć

Wyświetl plik

@ -17,6 +17,7 @@ import LoadingIndicator from 'soapbox/components/loading_indicator';
import MissingIndicator from 'soapbox/components/missing_indicator';
import SubNavigation from 'soapbox/components/sub_navigation';
import { getAccountGallery, findAccountByUsername } from 'soapbox/selectors';
import { getFeatures } from 'soapbox/utils/features';
import { expandAccountMediaTimeline } from '../../actions/timelines';
@ -26,6 +27,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const me = state.get('me');
const accountFetchError = ((state.getIn(['accounts', -1, 'username']) || '').toLowerCase() === username.toLowerCase());
const features = getFeatures(state.get('instance'));
let accountId = -1;
let accountUsername = username;
@ -38,7 +40,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
}
const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false);
const unavailable = (me === accountId) ? false : isBlocked;
const unavailable = (me === accountId) ? false : (isBlocked && !features.blockersVisible);
return {
accountId,

Wyświetl plik

@ -15,6 +15,7 @@ import Icon from 'soapbox/components/icon';
import MissingIndicator from 'soapbox/components/missing_indicator';
import SubNavigation from 'soapbox/components/sub_navigation';
import { makeGetStatusIds, findAccountByUsername } from 'soapbox/selectors';
import { getFeatures } from 'soapbox/utils/features';
import { fetchAccount, fetchAccountByUsername } from '../../actions/accounts';
import { fetchAccountIdentityProofs } from '../../actions/identity_proofs';
@ -31,6 +32,7 @@ const makeMapStateToProps = () => {
const me = state.get('me');
const accountFetchError = ((state.getIn(['accounts', -1, 'username']) || '').toLowerCase() === username.toLowerCase());
const soapboxConfig = getSoapboxConfig(state);
const features = getFeatures(state.get('instance'));
let accountId = -1;
let accountUsername = username;
@ -47,7 +49,7 @@ const makeMapStateToProps = () => {
const path = withReplies ? `${accountId}:with_replies` : accountId;
const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false);
const unavailable = (me === accountId) ? false : isBlocked;
const unavailable = (me === accountId) ? false : (isBlocked && !features.blockersVisible);
const showPins = getSettings(state).getIn(['account_timeline', 'shows', 'pinned']) && !withReplies;
return {

Wyświetl plik

@ -8,6 +8,7 @@ import { connect } from 'react-redux';
import MissingIndicator from 'soapbox/components/missing_indicator';
import { findAccountByUsername } from 'soapbox/selectors';
import { getFeatures } from 'soapbox/utils/features';
import { fetchAccount, fetchAccountByUsername } from '../../actions/accounts';
import { fetchFavouritedStatuses, expandFavouritedStatuses, fetchAccountFavouritedStatuses, expandAccountFavouritedStatuses } from '../../actions/favourites';
@ -26,6 +27,8 @@ const mapStateToProps = (state, { params }) => {
const isMyAccount = (username.toLowerCase() === meUsername.toLowerCase());
const features = getFeatures(state.get('instance'));
if (isMyAccount) {
return {
isMyAccount,
@ -46,7 +49,7 @@ const mapStateToProps = (state, { params }) => {
}
const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false);
const unavailable = (me === accountId) ? false : isBlocked;
const unavailable = (me === accountId) ? false : (isBlocked && !features.blockersVisible);
return {
isMyAccount,

Wyświetl plik

@ -9,6 +9,7 @@ import { connect } from 'react-redux';
import MissingIndicator from 'soapbox/components/missing_indicator';
import { findAccountByUsername } from 'soapbox/selectors';
import { getFollowDifference } from 'soapbox/utils/accounts';
import { getFeatures } from 'soapbox/utils/features';
import {
fetchAccount,
@ -29,6 +30,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const me = state.get('me');
const accountFetchError = ((state.getIn(['accounts', -1, 'username']) || '').toLowerCase() === username.toLowerCase());
const features = getFeatures(state.get('instance'));
let accountId = -1;
if (accountFetchError) {
@ -40,7 +42,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
const diffCount = getFollowDifference(state, accountId, 'followers');
const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false);
const unavailable = (me === accountId) ? false : isBlocked;
const unavailable = (me === accountId) ? false : (isBlocked && !features.blockersVisible);
return {
accountId,

Wyświetl plik

@ -9,6 +9,7 @@ import { connect } from 'react-redux';
import MissingIndicator from 'soapbox/components/missing_indicator';
import { findAccountByUsername } from 'soapbox/selectors';
import { getFollowDifference } from 'soapbox/utils/accounts';
import { getFeatures } from 'soapbox/utils/features';
import {
fetchAccount,
@ -29,6 +30,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const me = state.get('me');
const accountFetchError = ((state.getIn(['accounts', -1, 'username']) || '').toLowerCase() === username.toLowerCase());
const features = getFeatures(state.get('instance'));
let accountId = -1;
if (accountFetchError) {
@ -40,7 +42,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
const diffCount = getFollowDifference(state, accountId, 'following');
const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false);
const unavailable = (me === accountId) ? false : isBlocked;
const unavailable = (me === accountId) ? false : (isBlocked && !features.blockersVisible);
return {
accountId,

Wyświetl plik

@ -32,6 +32,7 @@ export const getFeatures = createSelector([
v.software === MASTODON && gte(v.compatVersion, '3.4.0'),
features.includes('v2_suggestions'),
]),
blockersVisible: features.includes('blockers_visible'),
trends: v.software === MASTODON && gte(v.compatVersion, '3.0.0'),
mediaV2: any([
v.software === MASTODON && gte(v.compatVersion, '3.1.3'),