Merge remote-tracking branch 'origin/develop' into revert-7d2ccc72
This commit is contained in:
@ -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',
|
||||
|
||||
@ -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'),
|
||||
|
||||
2
app/soapbox/utils/normalizers.js
Normal file
2
app/soapbox/utils/normalizers.js
Normal file
@ -0,0 +1,2 @@
|
||||
// Use new value only if old value is undefined
|
||||
export const mergeDefined = (oldVal, newVal) => oldVal === undefined ? newVal : oldVal;
|
||||
@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user