1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Able to edit image as attachment

This commit is contained in:
Zhiyuan Zheng
2020-12-06 16:06:38 +01:00
parent 0a86c2d627
commit add331ef0e
5 changed files with 337 additions and 157 deletions

View File

@ -84,6 +84,10 @@ export type PostAction =
type: 'attachmentUploadProgress'
payload: PostState['attachmentUploadProgress']
}
| {
type: 'attachmentEdit'
payload: Mastodon.Attachment & { local_url?: string }
}
| {
type: 'visibility'
payload: PostState['visibility']
@ -133,6 +137,13 @@ const postReducer = (state: PostState, action: PostAction): PostState => {
return { ...state, attachments: action.payload }
case 'attachmentUploadProgress':
return { ...state, attachmentUploadProgress: action.payload }
case 'attachmentEdit':
return {
...state,
attachments: state.attachments.map(attachment =>
attachment.id === action.payload.id ? action.payload : attachment
)
}
case 'visibility':
return { ...state, visibility: action.payload }
default: