Refactor Status component (#39731)
This commit is contained in:
10 files changed
+808
-57
No files matched your search
@@ -35,6 +35,8 @@ import {
|
||||
editStatus,
|
||||
muteStatus,
|
||||
setStatusQuotePolicy,
|
||||
translateStatus,
|
||||
undoStatusTranslation,
|
||||
unmuteStatus,
|
||||
} from './statuses';
|
||||
|
||||
@@ -53,7 +55,8 @@ export type StatusInteractionIntent =
|
||||
| 'redraft'
|
||||
| 'reply'
|
||||
| 'report'
|
||||
| 'revokeQuote';
|
||||
| 'revokeQuote'
|
||||
| 'translate';
|
||||
|
||||
const messages = defineMessages({
|
||||
noEdits: {
|
||||
@@ -77,12 +80,16 @@ export const statusInteraction = createAppThunk(
|
||||
contextType,
|
||||
intent,
|
||||
}: {
|
||||
statusId: string;
|
||||
statusId?: string;
|
||||
contextType?: StatusContextType;
|
||||
intent: StatusInteractionIntent;
|
||||
},
|
||||
{ getState, dispatch },
|
||||
) => {
|
||||
if (!statusId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const state = getState();
|
||||
const statusImmutable = state.statuses.get(statusId);
|
||||
if (!statusImmutable) {
|
||||
@@ -255,6 +262,12 @@ export const statusInteraction = createAppThunk(
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'translate':
|
||||
if (status.translation) {
|
||||
dispatch(undoStatusTranslation(statusId, status.poll));
|
||||
} else {
|
||||
dispatch(translateStatus(statusId));
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user