kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
normalizeAccount(): normalize `discoverable` field
rodzic
5cc962593e
commit
e6a797d712
|
@ -27,6 +27,7 @@ export const AccountRecord = ImmutableRecord({
|
||||||
birthday: undefined as Date | undefined,
|
birthday: undefined as Date | undefined,
|
||||||
bot: false,
|
bot: false,
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
|
discoverable: false,
|
||||||
display_name: '',
|
display_name: '',
|
||||||
emojis: ImmutableList<Emoji>(),
|
emojis: ImmutableList<Emoji>(),
|
||||||
favicon: '',
|
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>) => {
|
export const normalizeAccount = (account: Record<string, any>) => {
|
||||||
return AccountRecord(
|
return AccountRecord(
|
||||||
ImmutableMap(fromJS(account)).withMutations(account => {
|
ImmutableMap(fromJS(account)).withMutations(account => {
|
||||||
|
@ -269,6 +275,7 @@ export const normalizeAccount = (account: Record<string, any>) => {
|
||||||
normalizeLocation(account);
|
normalizeLocation(account);
|
||||||
normalizeFqn(account);
|
normalizeFqn(account);
|
||||||
normalizeFavicon(account);
|
normalizeFavicon(account);
|
||||||
|
normalizeDiscoverable(account);
|
||||||
addDomain(account);
|
addDomain(account);
|
||||||
addStaffFields(account);
|
addStaffFields(account);
|
||||||
fixUsername(account);
|
fixUsername(account);
|
||||||
|
|
Ładowanie…
Reference in New Issue