From a2666cc4fede900d9497cb7060f902317f5c6ee6 Mon Sep 17 00:00:00 2001 From: Son NK Date: Sat, 25 Apr 2020 15:30:19 +0200 Subject: [PATCH] remove "set-mailbox" form post --- app/dashboard/templates/dashboard/index.html | 47 +++++++++----------- app/dashboard/views/index.py | 25 +---------- 2 files changed, 22 insertions(+), 50 deletions(-) diff --git a/app/dashboard/templates/dashboard/index.html b/app/dashboard/templates/dashboard/index.html index 09fde197..0f9344c0 100644 --- a/app/dashboard/templates/dashboard/index.html +++ b/app/dashboard/templates/dashboard/index.html @@ -215,33 +215,28 @@
{% if mailboxes|length > 1 %} -
-
Current mailbox
-
-
- -
- -
- - - - - Update - -
- +
Current mailbox
+
+
+
- + + + +
{% elif alias_info.mailbox != None and alias_info.mailbox.email != current_user.email %}
Owned by {{ alias_info.mailbox.email }} mailbox diff --git a/app/dashboard/views/index.py b/app/dashboard/views/index.py index fce041a4..ca083d62 100644 --- a/app/dashboard/views/index.py +++ b/app/dashboard/views/index.py @@ -87,30 +87,7 @@ def index(): LOG.error("alias %s has been added before to DeletedAlias", email) db.session.rollback() - - elif request.form.get("form-name") == "set-mailbox": - alias_id = request.form.get("alias-id") - alias: Alias = Alias.get(alias_id) - mailbox_email = request.form.get("mailbox") - - mailbox = Mailbox.get_by(email=mailbox_email) - if not mailbox or mailbox.user_id != current_user.id: - flash("Something went wrong, please retry", "warning") - else: - alias.mailbox_id = mailbox.id - db.session.commit() - LOG.d("Set alias %s mailbox to %s", alias, mailbox) - - flash( - f"Update mailbox for {alias.email} to {mailbox_email}", "success", - ) - return redirect( - url_for( - "dashboard.index", highlight_alias_id=alias.id, query=query, - ) - ) - - return redirect(url_for("dashboard.index", query=query)) + return redirect(url_for("dashboard.index", query=query, sort=sort)) client_users = ( ClientUser.filter_by(user_id=current_user.id)