Move Account interface to types/ directory
This commit is contained in:
parent
8c7a7fd7dc
commit
6e61cb525c
3 changed files with 49 additions and 39 deletions
|
@ -1,45 +1,8 @@
|
|||
import { Map as ImmutableMap, List as ImmutableList, Record } from 'immutable';
|
||||
|
||||
import { IAccount } from 'soapbox/types';
|
||||
import { mergeDefined } from 'soapbox/utils/normalizers';
|
||||
|
||||
interface Account {
|
||||
acct: string;
|
||||
avatar: string;
|
||||
avatar_static: string;
|
||||
birthday: Date | undefined;
|
||||
bot: boolean;
|
||||
created_at: Date;
|
||||
display_name: string;
|
||||
emojis: ImmutableList<any>;
|
||||
fields: ImmutableList<any>;
|
||||
followers_count: number;
|
||||
following_count: number;
|
||||
fqn: string;
|
||||
header: string;
|
||||
header_static: string;
|
||||
id: string;
|
||||
last_status_at: Date;
|
||||
location: string;
|
||||
locked: boolean;
|
||||
moved: null;
|
||||
note: string;
|
||||
pleroma: ImmutableMap<any, any>;
|
||||
source: ImmutableMap<any, any>;
|
||||
statuses_count: number;
|
||||
uri: string;
|
||||
url: string;
|
||||
username: string;
|
||||
verified: boolean;
|
||||
|
||||
// Internal fields
|
||||
display_name_html: string;
|
||||
note_emojified: string;
|
||||
note_plain: string;
|
||||
patron: ImmutableMap<any, any>;
|
||||
relationship: ImmutableList<any>;
|
||||
should_refetch: boolean;
|
||||
}
|
||||
|
||||
const AccountRecord = Record({
|
||||
acct: '',
|
||||
avatar: '',
|
||||
|
@ -130,7 +93,7 @@ const normalizeLocation = (account: ImmutableMap<string, any>) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const normalizeAccount = (account: ImmutableMap<string, any>): Account => {
|
||||
export const normalizeAccount = (account: ImmutableMap<string, any>): IAccount => {
|
||||
return AccountRecord(
|
||||
account.withMutations(account => {
|
||||
normalizePleromaLegacyFields(account);
|
||||
|
|
44
app/soapbox/types/account.ts
Normal file
44
app/soapbox/types/account.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* Account entity.
|
||||
* https://docs.joinmastodon.org/entities/account/
|
||||
**/
|
||||
|
||||
interface IAccount {
|
||||
acct: string;
|
||||
avatar: string;
|
||||
avatar_static: string;
|
||||
birthday: Date | undefined;
|
||||
bot: boolean;
|
||||
created_at: Date;
|
||||
display_name: string;
|
||||
emojis: Iterable<any>;
|
||||
fields: Iterable<any>;
|
||||
followers_count: number;
|
||||
following_count: number;
|
||||
fqn: string;
|
||||
header: string;
|
||||
header_static: string;
|
||||
id: string;
|
||||
last_status_at: Date;
|
||||
location: string;
|
||||
locked: boolean;
|
||||
moved: null;
|
||||
note: string;
|
||||
pleroma: Record<any, any>;
|
||||
source: Record<any, any>;
|
||||
statuses_count: number;
|
||||
uri: string;
|
||||
url: string;
|
||||
username: string;
|
||||
verified: boolean;
|
||||
|
||||
// Internal fields
|
||||
display_name_html: string;
|
||||
note_emojified: string;
|
||||
note_plain: string;
|
||||
patron: Record<any, any>;
|
||||
relationship: Iterable<any>;
|
||||
should_refetch: boolean;
|
||||
}
|
||||
|
||||
export { IAccount };
|
3
app/soapbox/types/index.ts
Normal file
3
app/soapbox/types/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { IAccount } from './account';
|
||||
|
||||
export { IAccount };
|
Loading…
Reference in a new issue