Support the blockers_visible option when it's available

This commit is contained in:
NEETzsche 2022-01-14 18:06:31 -07:00
parent 5381b27c7e
commit 5fed85891f
6 changed files with 17 additions and 5 deletions

View file

@ -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,

View file

@ -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 {

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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'),