forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Glitch] Change design of lists in web UI
Port 6260350 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
- Loading branch information
1 parent
2259949
commit 217e0f8
Showing
37 changed files
with
1,368 additions
and
1,337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { apiCreate, apiUpdate } from 'flavours/glitch/api/lists'; | ||
import type { List } from 'flavours/glitch/models/list'; | ||
import { createDataLoadingThunk } from 'flavours/glitch/store/typed_functions'; | ||
|
||
export const createList = createDataLoadingThunk( | ||
'list/create', | ||
(list: Partial<List>) => apiCreate(list), | ||
); | ||
|
||
export const updateList = createDataLoadingThunk( | ||
'list/update', | ||
(list: Partial<List>) => apiUpdate(list), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
apiRequestPost, | ||
apiRequestPut, | ||
apiRequestGet, | ||
apiRequestDelete, | ||
} from 'flavours/glitch/api'; | ||
import type { ApiAccountJSON } from 'flavours/glitch/api_types/accounts'; | ||
import type { ApiListJSON } from 'flavours/glitch/api_types/lists'; | ||
|
||
export const apiCreate = (list: Partial<ApiListJSON>) => | ||
apiRequestPost<ApiListJSON>('v1/lists', list); | ||
|
||
export const apiUpdate = (list: Partial<ApiListJSON>) => | ||
apiRequestPut<ApiListJSON>(`v1/lists/${list.id}`, list); | ||
|
||
export const apiGetAccounts = (listId: string) => | ||
apiRequestGet<ApiAccountJSON[]>(`v1/lists/${listId}/accounts`, { | ||
limit: 0, | ||
}); | ||
|
||
export const apiGetAccountLists = (accountId: string) => | ||
apiRequestGet<ApiListJSON[]>(`v1/accounts/${accountId}/lists`); | ||
|
||
export const apiAddAccountToList = (listId: string, accountId: string) => | ||
apiRequestPost(`v1/lists/${listId}/accounts`, { | ||
account_ids: [accountId], | ||
}); | ||
|
||
export const apiRemoveAccountFromList = (listId: string, accountId: string) => | ||
apiRequestDelete(`v1/lists/${listId}/accounts`, { | ||
account_ids: [accountId], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// See app/serializers/rest/list_serializer.rb | ||
|
||
export type RepliesPolicyType = 'list' | 'followed' | 'none'; | ||
|
||
export interface ApiListJSON { | ||
id: string; | ||
title: string; | ||
exclusive: boolean; | ||
replies_policy: RepliesPolicyType; | ||
} |
Oops, something went wrong.