mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 00:38:27 +00:00
[Glitch] Use Immutable Record for accounts in Redux state
Port 3bf2a7296e to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
29
app/javascript/flavours/glitch/models/relationship.ts
Normal file
29
app/javascript/flavours/glitch/models/relationship.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { RecordOf } from 'immutable';
|
||||
import { Record } from 'immutable';
|
||||
|
||||
import type { ApiRelationshipJSON } from 'flavours/glitch/api_types/relationships';
|
||||
|
||||
type RelationshipShape = Required<ApiRelationshipJSON>; // no changes from server shape
|
||||
export type Relationship = RecordOf<RelationshipShape>;
|
||||
|
||||
const RelationshipFactory = Record<RelationshipShape>({
|
||||
blocked_by: false,
|
||||
blocking: false,
|
||||
domain_blocking: false,
|
||||
endorsed: false,
|
||||
followed_by: false,
|
||||
following: false,
|
||||
id: '',
|
||||
languages: null,
|
||||
muting_notifications: false,
|
||||
muting: false,
|
||||
note: '',
|
||||
notifying: false,
|
||||
requested_by: false,
|
||||
requested: false,
|
||||
showing_reblogs: false,
|
||||
});
|
||||
|
||||
export function createRelationship(attributes: Partial<RelationshipShape>) {
|
||||
return RelationshipFactory(attributes);
|
||||
}
|
||||
Reference in New Issue
Block a user