Skip to content
Snippets Groups Projects
Unverified Commit adb93f19 authored by Mahatthana (Kelvin) Nomsawadi's avatar Mahatthana (Kelvin) Nomsawadi Committed by GitHub
Browse files

Fix basic actions aren't showing in the order of CUD (#31184)

parent 3a1a4157
No related branches found
No related tags found
No related merge requests found
......@@ -57,11 +57,14 @@ const defaultImplicitActionCreateOptions = {
const enableImplicitActionsForModel =
async (modelId: number, options = defaultImplicitActionCreateOptions) =>
async (dispatch: Dispatch) => {
if (options.insert) {
// We're ordering actions that's most recently created first.
// So if we want to show Create, Update, Delete, then we need
// to create them in the reverse order.
if (options.delete) {
await ActionsApi.create({
name: t`Create`,
name: t`Delete`,
type: "implicit",
kind: "row/create",
kind: "row/delete",
model_id: modelId,
});
}
......@@ -75,11 +78,11 @@ const enableImplicitActionsForModel =
});
}
if (options.delete) {
if (options.insert) {
await ActionsApi.create({
name: t`Delete`,
name: t`Create`,
type: "implicit",
kind: "row/delete",
kind: "row/create",
model_id: modelId,
});
}
......
......@@ -218,7 +218,7 @@ function NoActionsState({
function mostRecentFirst(action: WritebackAction) {
const createdAt = parseTimestamp(action["created_at"]);
return -createdAt.unix();
return -createdAt.valueOf();
}
// eslint-disable-next-line import/no-default-export -- deprecated usage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment