Merge remote-tracking branch 'origin/develop' into revert-7d2ccc72

This commit is contained in:
Alex Gleason
2022-02-28 14:15:09 -06:00
23 changed files with 489 additions and 183 deletions

View File

@ -119,7 +119,7 @@ describe('isModerator', () => {
describe('accountToMention', () => {
it('converts the account to a mention', () => {
const account = fromJS(require('soapbox/__fixtures__/alex.json'));
const account = fromJS(require('soapbox/__fixtures__/pleroma-account.json'));
const expected = fromJS({
id: '9v5bmRalQvjOy0ECcC',

View File

@ -1,8 +1,4 @@
import {
Map as ImmutableMap,
List as ImmutableList,
OrderedSet as ImmutableOrderedSet,
} from 'immutable';
import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet } from 'immutable';
const getDomainFromURL = (account: ImmutableMap<string, any>): string => {
try {
@ -67,11 +63,6 @@ export const isLocal = (account: ImmutableMap<string, any>): boolean => {
export const isRemote = (account: ImmutableMap<string, any>): boolean => !isLocal(account);
export const isVerified = (account: ImmutableMap<string, any>): boolean => {
const tags: any = account.getIn(['pleroma', 'tags'], ImmutableList());
return tags.includes('verified');
};
export const accountToMention = (account: ImmutableMap<string, any>): ImmutableMap<string, any> => {
return ImmutableMap({
id: account.get('id'),

View File

@ -0,0 +1,2 @@
// Use new value only if old value is undefined
export const mergeDefined = (oldVal, newVal) => oldVal === undefined ? newVal : oldVal;

View File

@ -1,10 +0,0 @@
// https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/549
export const normalizePleromaUserFields = obj => {
obj.is_active = obj.is_active === undefined ? !obj.deactivated : obj.is_active;
obj.is_confirmed = obj.is_confirmed === undefined ? !obj.confirmation_pending : obj.is_confirmed;
obj.is_approved = obj.is_approved === undefined ? !obj.approval_pending : obj.is_approved;
delete obj.deactivated;
delete obj.confirmation_pending;
delete obj.approval_pending;
return obj;
};