From 8ac0751f5b15ee39625bf0748590a3fed009fd83 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 12 Oct 2021 11:17:28 -0700 Subject: [PATCH] email_server: Turn home view into a simple page rather than a tab Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/email_server/views.py | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/plinth/modules/email_server/views.py b/plinth/modules/email_server/views.py index 66bb98b3d..787647ab7 100644 --- a/plinth/modules/email_server/views.py +++ b/plinth/modules/email_server/views.py @@ -18,18 +18,10 @@ from . import aliases, audit, forms class TabMixin(View): - admin_tabs = [ - ('', _('Home')), - ('my_mail', _('My Mail')), - ('my_aliases', _('My Aliases')), - ('security', _('Security')), - ('domains', _('Domains')) - ] + admin_tabs = [('', _('Home')), ('my_aliases', _('My Aliases')), + ('security', _('Security')), ('domains', _('Domains'))] - user_tabs = [ - ('my_mail', _('Home')), - ('my_aliases', _('My Aliases')) - ] + user_tabs = [('my_aliases', _('My Aliases'))] def get_context_data(self, *args, **kwargs): # Retrieve context data from the next method in the MRO @@ -137,29 +129,24 @@ class EmailServerView(TabMixin, AppView): plinth.actions.superuser_run('service', ['reload', service]) -class MyMailView(TabMixin, TemplateView): +class MyMailView(TemplateView): template_name = 'my_mail.html' def get_context_data(self, *args, **kwargs): context = super().get_context_data(*args, **kwargs) - nam = self.request.user.username context['has_homedir'] = audit.home.exists_nam(nam) - return context def post(self, request): - return self.catch_exceptions(self._post, request) - - def _post(self, request): - if 'btn_mkhome' not in request.POST: - raise ValidationError('Bad post data') audit.home.put_nam(request.user.username) return self.render_to_response(self.get_context_data()) class AliasView(TabMixin, TemplateView): + class Checkboxes: + def __init__(self, post=None, initial=None): self.models = initial self.post = post