Avoid deprecated User.email_address property

This commit is contained in:
Lance Edgar 2023-08-30 23:32:09 -05:00
parent 9f65de2ba6
commit 625982d639
3 changed files with 11 additions and 2 deletions

View file

@ -90,7 +90,7 @@
${parent.modify_this_page_vars()} ${parent.modify_this_page_vars()}
<script type="text/javascript"> <script type="text/javascript">
ThisPageData.testRecipient = ${json.dumps(request.user.email_address)|n} ThisPageData.testRecipient = ${json.dumps(user_email_address)|n}
ThisPageData.sendingTest = false ThisPageData.sendingTest = false
ThisPage.methods.sendTest = function() { ThisPage.methods.sendTest = function() {

View file

@ -84,7 +84,7 @@
return { return {
previewFormButtonText: "Send Preview Email", previewFormButtonText: "Send Preview Email",
previewFormSubmitting: false, previewFormSubmitting: false,
userEmailAddress: ${json.dumps(request.user.email_address)|n}, userEmailAddress: ${json.dumps(user_email_address)|n},
} }
}, },
methods: { methods: {

View file

@ -268,8 +268,14 @@ class EmailSettingView(MasterView):
return data return data
def template_kwargs_view(self, **kwargs): def template_kwargs_view(self, **kwargs):
kwargs = super().template_kwargs_view(**kwargs)
app = self.get_rattail_app()
key = self.request.matchdict['key'] key = self.request.matchdict['key']
kwargs['email'] = self.email_handler.get_email(key) kwargs['email'] = self.email_handler.get_email(key)
kwargs['user_email_address'] = app.get_contact_email_address(self.request.user)
return kwargs return kwargs
def configure_get_simple_settings(self): def configure_get_simple_settings(self):
@ -293,12 +299,15 @@ class EmailSettingView(MasterView):
def configure_get_context(self, *args, **kwargs): def configure_get_context(self, *args, **kwargs):
context = super().configure_get_context(*args, **kwargs) context = super().configure_get_context(*args, **kwargs)
app = self.get_rattail_app()
# prettify list of template paths # prettify list of template paths
templates = self.rattail_config.parse_list( templates = self.rattail_config.parse_list(
context['simple_settings']['rattail.mail.templates']) context['simple_settings']['rattail.mail.templates'])
context['simple_settings']['rattail.mail.templates'] = ', '.join(templates) context['simple_settings']['rattail.mail.templates'] = ', '.join(templates)
context['user_email_address'] = app.get_contact_email_address(self.request.user)
return context return context
def toggle_hidden(self): def toggle_hidden(self):