normalizeAccount(): normalize discoverable field

This commit is contained in:
Alex Gleason 2022-04-29 12:59:13 -05:00
parent 5cc962593e
commit e6a797d712
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -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);