From 50a2ec69c254e09fa74f4a096342999b4fdd3452 Mon Sep 17 00:00:00 2001 From: Darks Date: Mon, 12 Jun 2023 20:04:20 +0200 Subject: [PATCH] glados: updated announces --- app/routes/account/account.py | 2 ++ app/routes/forum/index.py | 3 +++ app/routes/forum/topic.py | 4 +++- app/routes/programs/program.py | 5 ++++- app/routes/programs/submit.py | 4 +++- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/routes/account/account.py b/app/routes/account/account.py index a4479ec..1ffc0c6 100644 --- a/app/routes/account/account.py +++ b/app/routes/account/account.py @@ -189,4 +189,6 @@ def activate_account(token): flash("L'email a bien été confirmé", "ok") app.v5logger.info(f"<{m.name}> has activated their account") say(f"Un nouveau membre s’est inscrit ! Il s’agit de {BOLD}{m.name}{BOLD}.") + say(url_for('user', username=m.name, _external=True)) + return redirect(url_for('login')) diff --git a/app/routes/forum/index.py b/app/routes/forum/index.py index 944f95a..ad9c680 100644 --- a/app/routes/forum/index.py +++ b/app/routes/forum/index.py @@ -4,6 +4,7 @@ from flask import request, redirect, url_for, abort, flash from app import app, db from config import V5Config from app.utils.render import render +from app.utils.glados import say, BOLD from app.forms.forum import TopicCreationForm, AnonymousTopicCreationForm from app.models.forum import Forum from app.models.topic import Topic @@ -76,6 +77,8 @@ def forum_page(f, page=1): app.v5logger.info(f"<{t.author.name}> has created the topic #{t.id}") if f.is_default_accessible(): say(f"Nouveau topic de {author.name} : {BOLD}{t.title}{BOLD}") + say(url_for('forum_topic', f=f, page=(t, 1), _external=True)) + return redirect(url_for('forum_topic', f=f, page=(t,1))) # Paginate topic pages diff --git a/app/routes/forum/topic.py b/app/routes/forum/topic.py index 8b98cf5..137d539 100644 --- a/app/routes/forum/topic.py +++ b/app/routes/forum/topic.py @@ -57,7 +57,9 @@ def forum_topic(f, page): flash('Message envoyé', 'ok') app.v5logger.info(f"<{c.author.name}> has posted a the comment #{c.id}") if f.is_default_accessible(): - say(f"Nouveau commentaire de {author.name} sur un topic : {BOLD}{t.title}{BOLD}") + say(f"Nouveau commentaire de {author.name} sur le topic : {BOLD}{t.title}{BOLD}") + say(url_for('forum_topic', f=f, page=(t, "fin"), _anchor=str(c.id), _external=True)) + # Redirect to empty the form return redirect(url_for('forum_topic', f=f, page=(t, "fin"), _anchor=str(c.id))) diff --git a/app/routes/programs/program.py b/app/routes/programs/program.py index 0673fd3..bae5936 100644 --- a/app/routes/programs/program.py +++ b/app/routes/programs/program.py @@ -4,6 +4,7 @@ from app.models.program import Program from app.models.comment import Comment from app.models.thread import Thread from app.utils.render import render +from app.utils.glados import say, BOLD from app.forms.forum import CommentForm, AnonymousCommentForm from config import V5Config @@ -42,7 +43,9 @@ def program_view(page): flash('Message envoyé', 'ok') app.v5logger.info(f"<{c.author.name}> has posted a the comment #{c.id}") - say(f"Nouveau commentaire de {author.name} sur un programme: {BOLD}{t.name}{BOLD}") + say(f"Nouveau commentaire de {author.name} sur le programme : {BOLD}{p.name}{BOLD}") + say(url_for('program_view', page=(p, "fin"), _anchor=str(c.id), _external=True)) + # Redirect to empty the form return redirect(url_for('program_view', page=(p, "fin"), _anchor=str(c.id))) diff --git a/app/routes/programs/submit.py b/app/routes/programs/submit.py index 0bcdf0e..65bff59 100644 --- a/app/routes/programs/submit.py +++ b/app/routes/programs/submit.py @@ -57,6 +57,8 @@ def program_submit(): flash('Le programme a bien été soumis', 'ok') app.v5logger.info(f"<{p.author.name}> has submitted the program #{c.id}") say(f"Nouveau programme de {current_user.name} : {BOLD}{p.name}{BOLD}") - return redirect(url_for('program_index')) + say(url_for('program_view', page=(p, 1), _external=True)) + + return redirect(url_for('program_view', page=(p, 1))) return render('/programs/submit.html', form=form)