From 8fc68b1594d29afb572b5c0e313ee83e27c2a948 Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 2 Sep 2026 00:02:53 +0700 Subject: [PATCH] feat(autosending): enable by default --- ...831144623_enable-autosending-by-default.js | 27 +++++++++++++++++++ src/config.js | 2 +- src/containers/AdminAutosending/index.tsx | 25 ++++++++++++++++- 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 migrations/20260831144623_enable-autosending-by-default.js diff --git a/migrations/20260831144623_enable-autosending-by-default.js b/migrations/20260831144623_enable-autosending-by-default.js new file mode 100644 index 000000000..7d829e174 --- /dev/null +++ b/migrations/20260831144623_enable-autosending-by-default.js @@ -0,0 +1,27 @@ +const DEFAULT_AUTOSENDING_MPS = 3; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.up = async function up(knex) { + await knex.schema.alterTable("organization", (table) => { + table.integer("autosending_mps").defaultTo(DEFAULT_AUTOSENDING_MPS).alter(); + }); + + await knex("organization") + .whereNull("autosending_mps") + .update({ autosending_mps: DEFAULT_AUTOSENDING_MPS }); +}; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.down = function down(knex) { + return knex.raw(` + alter table organization + alter column autosending_mps + drop default + `); +}; diff --git a/src/config.js b/src/config.js index c676c8cdb..1844a611d 100644 --- a/src/config.js +++ b/src/config.js @@ -112,7 +112,7 @@ const validators = { }), ENABLE_AUTOSENDING: bool({ desc: "Whether autosending is enabled", - default: false, + default: true, isClient: true }), DISABLE_ASSIGNMENT_CASCADE: bool({ diff --git a/src/containers/AdminAutosending/index.tsx b/src/containers/AdminAutosending/index.tsx index 4fea3bcb5..1e8ad0619 100644 --- a/src/containers/AdminAutosending/index.tsx +++ b/src/containers/AdminAutosending/index.tsx @@ -1,3 +1,4 @@ +import Button from "@material-ui/core/Button"; import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardHeader from "@material-ui/core/CardHeader"; @@ -35,6 +36,7 @@ import AutosendingTargetRow from "./components/AutosendingTargetRow"; import AutosendingUnstartedTargetRow from "./components/AutosendingUnstartedTargetRow"; const useStyles = makeStyles({ + throughputNotice: { marginBottom: 16 }, select: { width: 150, marginRight: 10 } }); @@ -116,6 +118,11 @@ const AdminAutosending: React.FC = () => { [setAlertErrorMessage] ); + const handleContactSupport = useCallback( + () => window.$chatwoot?.toggle("open"), + [] + ); + const handlePlayFactory = useCallback( (campaignId: string) => () => startAutosending({ variables: { campaignId } }), @@ -160,7 +167,7 @@ const AdminAutosending: React.FC = () => { {alertErrorMessage?.replace("GraphQL error:", "")} - {data?.organization && data.organization.autosendingMps === null ? ( + {data?.organization && (data.organization.autosendingMps ?? 0) <= 0 ? ( { } /> + {data?.organization && ( + + Contact support + + ) : undefined + } + > + Autosending rate: {data.organization.autosendingMps} messages + per second. Higher rates are available on request. + + )}