From accbf882c4500f7b34e0ce9290cf76e48ecd46bc Mon Sep 17 00:00:00 2001 From: Son Date: Wed, 3 Nov 2021 10:11:47 +0100 Subject: [PATCH] user can set one_click_unsubscribe_block_sender setting --- .../templates/dashboard/setting.html | 24 +++++++++++++++++++ app/dashboard/views/setting.py | 9 +++++++ 2 files changed, 33 insertions(+) diff --git a/app/dashboard/templates/dashboard/setting.html b/app/dashboard/templates/dashboard/setting.html index bfbb9c36..cbc59151 100644 --- a/app/dashboard/templates/dashboard/setting.html +++ b/app/dashboard/templates/dashboard/setting.html @@ -403,6 +403,30 @@ + +
+
+
One-click unsubscribe
+
+ On email clients that support the + One-click unsubscribe button, + clicking on it will disable the alias that receives the emails. +
+ You can choose to block the sender instead of disabling the alias. +
+
+ +
+ + +
+ +
+
+
+ +
Quarantine
diff --git a/app/dashboard/views/setting.py b/app/dashboard/views/setting.py index a59a95c1..993698b4 100644 --- a/app/dashboard/views/setting.py +++ b/app/dashboard/views/setting.py @@ -309,6 +309,15 @@ def setting(): Session.commit() flash("Your preference has been updated", "success") return redirect(url_for("dashboard.setting")) + elif request.form.get("form-name") == "one-click-unsubscribe": + choose = request.form.get("enable") + if choose == "on": + current_user.one_click_unsubscribe_block_sender = True + else: + current_user.one_click_unsubscribe_block_sender = False + Session.commit() + flash("Your preference has been updated", "success") + return redirect(url_for("dashboard.setting")) elif request.form.get("form-name") == "export-data": return redirect(url_for("api.export_data"))