relationship.ts 790 B

1234567891011121314151617181920212223242526272829
  1. import type { RecordOf } from 'immutable';
  2. import { Record } from 'immutable';
  3. import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
  4. type RelationshipShape = Required<ApiRelationshipJSON>; // no changes from server shape
  5. export type Relationship = RecordOf<RelationshipShape>;
  6. const RelationshipFactory = Record<RelationshipShape>({
  7. blocked_by: false,
  8. blocking: false,
  9. domain_blocking: false,
  10. endorsed: false,
  11. followed_by: false,
  12. following: false,
  13. id: '',
  14. languages: null,
  15. muting_notifications: false,
  16. muting: false,
  17. note: '',
  18. notifying: false,
  19. requested_by: false,
  20. requested: false,
  21. showing_reblogs: false,
  22. });
  23. export function createRelationship(attributes: Partial<RelationshipShape>) {
  24. return RelationshipFactory(attributes);
  25. }