glitch-soc/mastodon

View on GitHub
app/javascript/flavours/glitch/models/list.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { RecordOf } from 'immutable';
import { Record } from 'immutable';

import type { ApiListJSON } from 'flavours/glitch/api_types/lists';

type ListShape = Required<ApiListJSON>; // no changes from server shape
export type List = RecordOf<ListShape>;

const ListFactory = Record<ListShape>({
  id: '',
  title: '',
  exclusive: false,
  replies_policy: 'list',
});

export function createList(attributes: Partial<ListShape>) {
  return ListFactory(attributes);
}