From a520ae5613bbcf78fa89eacb0bac614c067e12b5 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Tue, 2 Jul 2024 11:57:11 +0200 Subject: [PATCH] fixup --- lib/plausible/site/traffic_change_notification.ex | 1 + lib/plausible_web/templates/site/traffic_change_form.heex | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/plausible/site/traffic_change_notification.ex b/lib/plausible/site/traffic_change_notification.ex index 6d4a0f70fa7c..3b44b5e356c8 100644 --- a/lib/plausible/site/traffic_change_notification.ex +++ b/lib/plausible/site/traffic_change_notification.ex @@ -17,6 +17,7 @@ defmodule Plausible.Site.TrafficChangeNotification do schema |> cast(attrs, [:site_id, :recipients, :threshold, :type]) |> validate_required([:site_id, :recipients, :threshold, :type]) + |> validate_number(:threshold, greater_than_or_equal_to: 0) |> unique_constraint([:site_id, :type]) end diff --git a/lib/plausible_web/templates/site/traffic_change_form.heex b/lib/plausible_web/templates/site/traffic_change_form.heex index 7d7172e7521a..2778b722027c 100644 --- a/lib/plausible_web/templates/site/traffic_change_form.heex +++ b/lib/plausible_web/templates/site/traffic_change_form.heex @@ -44,6 +44,7 @@ <%= number_input(f, :threshold, + min: 0, class: "focus:ring-indigo-500 dark:bg-gray-900 focus:border-indigo-500 block w-full rounded-none rounded-l-md pl-10 sm:text-sm border-gray-300 dark:border-gray-500 dark:text-gray-100" ) %>