Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions migrations/20260831144623_enable-autosending-by-default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const DEFAULT_AUTOSENDING_MPS = 3;

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
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<void> }
*/
exports.down = function down(knex) {
return knex.raw(`
alter table organization
alter column autosending_mps
drop default
`);
};
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const validators = {
}),
ENABLE_AUTOSENDING: bool({
desc: "Whether autosending is enabled",
default: false,
default: true,
isClient: true
}),
DISABLE_ASSIGNMENT_CASCADE: bool({
Expand Down
25 changes: 24 additions & 1 deletion src/containers/AdminAutosending/index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 }
});

Expand Down Expand Up @@ -116,6 +118,11 @@ const AdminAutosending: React.FC = () => {
[setAlertErrorMessage]
);

const handleContactSupport = useCallback(
() => window.$chatwoot?.toggle("open"),
[]
);

const handlePlayFactory = useCallback(
(campaignId: string) => () =>
startAutosending({ variables: { campaignId } }),
Expand Down Expand Up @@ -160,7 +167,7 @@ const AdminAutosending: React.FC = () => {
{alertErrorMessage?.replace("GraphQL error:", "")}
</Alert>
</Snackbar>
{data?.organization && data.organization.autosendingMps === null ? (
{data?.organization && (data.organization.autosendingMps ?? 0) <= 0 ? (
<CardHeader
title="No autosending throughput has been allocated to this organization."
subheader="Please contact the administrator of your Spoke instance."
Expand Down Expand Up @@ -214,6 +221,22 @@ const AdminAutosending: React.FC = () => {
}
/>
<CardContent>
{data?.organization && (
<Alert
className={inlineStyles.throughputNotice}
severity="info"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: My only feedback is that the orange stands out a bit more to me than I would like because imo i think we want most clients to not even think about the sending speed here. With that said, I'd defer to you on the best approach (or @cjmabry if you have any thoughts on how we should best communicate this)

action={
window.CHATWOOT_WEBSITE_TOKEN && window.CHATWOOT_BASE_URL ? (
<Button color="inherit" onClick={handleContactSupport}>
Contact support
</Button>
) : undefined
}
>
Autosending rate: {data.organization.autosendingMps} messages
per second. Higher rates are available on request.
</Alert>
)}
<TableContainer component={Paper}>
<Table>
<TableHead>
Expand Down
Loading