Add circle posts history support (#18)

* Wip: make web backend

* Wip: keep statuses if edit circle

* Wip: Add circle history page and record circle posts

* Add circle post to history in web ui when post

* Add test
This commit is contained in:
KMY(雪あすか) 2023-09-24 13:01:09 +09:00 committed by GitHub
parent 0a42f4b7e2
commit df3b3f4185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 544 additions and 15 deletions

View file

@ -28,6 +28,8 @@ export const COMPOSE_DIRECT = 'COMPOSE_DIRECT';
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
export const COMPOSE_RESET = 'COMPOSE_RESET';
export const COMPOSE_WITH_CIRCLE_SUCCESS = 'COMPOSE_WITH_CIRCLE_SUCCESS';
export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST';
export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS';
export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL';
@ -174,6 +176,7 @@ export function submitCompose(routerHistory) {
const status = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const statusId = getState().getIn(['compose', 'id'], null);
const circleId = getState().getIn(['compose', 'circle_id'], null);
if ((!status || !status.length) && media.size === 0) {
return;
@ -253,6 +256,10 @@ export function submitCompose(routerHistory) {
insertIfOnline(`account:${response.data.account.id}`);
}
if (statusId === null && circleId !== null && circleId !== 0) {
dispatch(submitComposeWithCircleSuccess({ ...response.data }, circleId));
}
dispatch(showAlert({
message: statusId === null ? messages.published : messages.saved,
action: messages.open,
@ -278,6 +285,14 @@ export function submitComposeSuccess(status) {
};
}
export function submitComposeWithCircleSuccess(status, circleId) {
return {
type: COMPOSE_WITH_CIRCLE_SUCCESS,
status,
circleId,
}
}
export function submitComposeFail(error) {
return {
type: COMPOSE_SUBMIT_FAIL,