clear topic cache when topics change

This commit is contained in:
rimu 2024-05-31 21:55:55 +12:00
parent e759e7afb1
commit 30f2b5a681

View file

@ -417,6 +417,7 @@ def admin_topic_add():
topic.parent_id = None topic.parent_id = None
db.session.add(topic) db.session.add(topic)
db.session.commit() db.session.commit()
cache.delete_memoized(menu_topics)
flash(_('Saved')) flash(_('Saved'))
return redirect(url_for('admin.admin_topics')) return redirect(url_for('admin.admin_topics'))
@ -444,6 +445,7 @@ def admin_topic_edit(topic_id):
else: else:
topic.parent_id = None topic.parent_id = None
db.session.commit() db.session.commit()
cache.delete_memoized(menu_topics)
flash(_('Saved')) flash(_('Saved'))
return redirect(url_for('admin.admin_topics')) return redirect(url_for('admin.admin_topics'))
else: else:
@ -471,6 +473,8 @@ def admin_topic_delete(topic_id):
flash(_('Cannot delete topic with communities assigned to it.', 'error')) flash(_('Cannot delete topic with communities assigned to it.', 'error'))
db.session.commit() db.session.commit()
cache.delete_memoized(menu_topics)
return redirect(url_for('admin.admin_topics')) return redirect(url_for('admin.admin_topics'))