fix duplicate broadcast message issue

This commit is contained in:
forest 2022-04-12 14:20:02 -05:00
parent dd1d9cff2b
commit 4dadab60d8

View File

@ -15,6 +15,7 @@ from flask import render_template
from flask import url_for
from flask import current_app
from flask import flash
from flask import session
from apscheduler.schedulers.background import BackgroundScheduler
@ -210,6 +211,10 @@ def security_headers(response):
response.headers['X-Content-Type-Options'] = 'nosniff'
if current_app.config['BROADCAST_BANNER_MESSAGE'] is not None and current_app.config['BROADCAST_BANNER_MESSAGE'] != "":
for t in session.get("_flashes", []):
if t is not None and t[1] == current_app.config['BROADCAST_BANNER_MESSAGE']:
return response
flash(current_app.config['BROADCAST_BANNER_MESSAGE'])
return response