feat(messages): add conditional post-send flash with email notification info
This commit is contained in:
parent
e3980f046f
commit
95848daa5c
@ -223,7 +223,10 @@ def messages_send():
|
||||
import logging
|
||||
logging.getLogger(__name__).warning(f"Failed to send message email notification: {e}")
|
||||
|
||||
flash('Wiadomość wysłana.', 'success')
|
||||
if recipient.notify_email_messages != False and recipient.email:
|
||||
flash('Wiadomość wysłana! Odbiorca zostanie powiadomiony emailem.', 'success')
|
||||
else:
|
||||
flash('Wiadomość wysłana!', 'success')
|
||||
return redirect(url_for('.messages_sent'))
|
||||
finally:
|
||||
db.close()
|
||||
@ -306,6 +309,8 @@ def messages_reply(message_id):
|
||||
flash('Nie można wysłać wiadomości do tego użytkownika.', 'error')
|
||||
return redirect(url_for('.messages_inbox'))
|
||||
|
||||
recipient = db.query(User).filter(User.id == recipient_id).first()
|
||||
|
||||
reply = PrivateMessage(
|
||||
sender_id=current_user.id,
|
||||
recipient_id=recipient_id,
|
||||
@ -316,7 +321,10 @@ def messages_reply(message_id):
|
||||
db.add(reply)
|
||||
db.commit()
|
||||
|
||||
flash('Odpowiedź wysłana.', 'success')
|
||||
if recipient and recipient.notify_email_messages != False and recipient.email:
|
||||
flash('Odpowiedź wysłana! Odbiorca zostanie powiadomiony emailem.', 'success')
|
||||
else:
|
||||
flash('Odpowiedź wysłana!', 'success')
|
||||
return redirect(url_for('.messages_view', message_id=message_id))
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user