From 0f8e7b1ff801f634ee395ad8f00bb4c655ee4b49 Mon Sep 17 00:00:00 2001 From: chance-stribling Date: Fri, 22 Mar 2024 10:52:00 -0400 Subject: [PATCH 1/2] notify_user now gets a value of 1 in the db --- app/Console/Commands/SendFilterNotifications.php | 2 +- app/Http/Controllers/FiltersController.php | 2 +- resources/assets/js/components/AdvancedFiltersModal.jsx | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/SendFilterNotifications.php b/app/Console/Commands/SendFilterNotifications.php index f4d2e5fc..bdd830ae 100644 --- a/app/Console/Commands/SendFilterNotifications.php +++ b/app/Console/Commands/SendFilterNotifications.php @@ -15,7 +15,7 @@ class SendFilterNotifications extends Command * * @var string */ - protected $signature = 'notify:filters {-p|--print=0}'; + protected $signature = 'notify:filters {print=0}'; /** * The console command description. diff --git a/app/Http/Controllers/FiltersController.php b/app/Http/Controllers/FiltersController.php index 9d87d981..e4658f67 100644 --- a/app/Http/Controllers/FiltersController.php +++ b/app/Http/Controllers/FiltersController.php @@ -146,7 +146,7 @@ public function create(Request $request, $with_observations = false) 'user_id' => $user->id, 'name' => $request->name, 'rules' => $request->all(), - 'notify_user' => false, + 'notify_user' => $request->notify_user, ]); } diff --git a/resources/assets/js/components/AdvancedFiltersModal.jsx b/resources/assets/js/components/AdvancedFiltersModal.jsx index ce08262c..fb71a72c 100644 --- a/resources/assets/js/components/AdvancedFiltersModal.jsx +++ b/resources/assets/js/components/AdvancedFiltersModal.jsx @@ -50,6 +50,7 @@ export default class AdvancedFiltersModal extends Component { endDate : null, groups : [], selectedGroup : -1, + notify_user : true, } } @@ -128,6 +129,7 @@ export default class AdvancedFiltersModal extends Component { start: this.state.startDate ? this.state.startDate.format('YYYY-MM-DD') : null, end : this.state.endDate ? this.state.endDate.format('YYYY-MM-DD') : null, }, + notify_user : this.state.notify_user, } if (this.props.applyFilters) { @@ -168,6 +170,10 @@ export default class AdvancedFiltersModal extends Component { this.setState({loading: false}) }) + + if(this.state.notify_user == true){ + console.log('triggered') + } } count(changed) { @@ -204,6 +210,7 @@ export default class AdvancedFiltersModal extends Component { start: this.state.startDate ? this.state.startDate.format('YYYY-MM-DD') : null, end : this.state.endDate ? this.state.endDate.format('YYYY-MM-DD') : null, }, + notify_user : filters.notify_user }).then(response => { this.setState({ loading : false, @@ -538,7 +545,7 @@ export default class AdvancedFiltersModal extends Component {

Maximum of 3 emails per week.

From 57d24dc0d1f1936facebd2b33dd5cdab36003604 Mon Sep 17 00:00:00 2001 From: chance-stribling Date: Fri, 22 Mar 2024 14:43:16 -0400 Subject: [PATCH 2/2] Email is sent when new observation matches filter --- app/Console/Commands/SendFilterNotifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/SendFilterNotifications.php b/app/Console/Commands/SendFilterNotifications.php index bdd830ae..65c16470 100644 --- a/app/Console/Commands/SendFilterNotifications.php +++ b/app/Console/Commands/SendFilterNotifications.php @@ -15,7 +15,7 @@ class SendFilterNotifications extends Command * * @var string */ - protected $signature = 'notify:filters {print=0}'; + protected $signature = 'notify:filters {--print}'; /** * The console command description.