normalizeAccount(): normalize discoverable
field
This commit is contained in:
parent
5cc962593e
commit
e6a797d712
1 changed files with 7 additions and 0 deletions
|
@ -27,6 +27,7 @@ export const AccountRecord = ImmutableRecord({
|
|||
birthday: undefined as Date | undefined,
|
||||
bot: false,
|
||||
created_at: new Date(),
|
||||
discoverable: false,
|
||||
display_name: '',
|
||||
emojis: ImmutableList<Emoji>(),
|
||||
favicon: '',
|
||||
|
@ -255,6 +256,11 @@ const addStaffFields = (account: ImmutableMap<string, any>) => {
|
|||
});
|
||||
};
|
||||
|
||||
const normalizeDiscoverable = (account: ImmutableMap<string, any>) => {
|
||||
const discoverable = Boolean(account.get('discoverable') || account.getIn(['source', 'pleroma', 'discoverable']));
|
||||
return account.set('discoverable', discoverable);
|
||||
};
|
||||
|
||||
export const normalizeAccount = (account: Record<string, any>) => {
|
||||
return AccountRecord(
|
||||
ImmutableMap(fromJS(account)).withMutations(account => {
|
||||
|
@ -269,6 +275,7 @@ export const normalizeAccount = (account: Record<string, any>) => {
|
|||
normalizeLocation(account);
|
||||
normalizeFqn(account);
|
||||
normalizeFavicon(account);
|
||||
normalizeDiscoverable(account);
|
||||
addDomain(account);
|
||||
addStaffFields(account);
|
||||
fixUsername(account);
|
||||
|
|
Loading…
Reference in a new issue