Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
4 changed files with 22 additions and 16 deletions
Showing only changes of commit 2745ffd687 - Show all commits

View File

@ -53,7 +53,9 @@ class CreateBugReport(FlaskForm):
)
etab = StringField(label="Etablissement")
include_dump = BooleanField(
"Inclure une copie anonymisée de la base de données ? (ces données permettent aux développeur·euse·s de reproduire l'erreur rencontrée)",
"""Inclure une copie anonymisée de la base de données ?
Ces données faciliteront le traitement du problème et resteront strictement confidentielles.
""",
default=False,
)
submit = SubmitField("Envoyer")

View File

@ -36,18 +36,22 @@ Le principe est le suivant:
informations fournies par l'utilisateur + quelques métadonnées.
"""
import app.scodoc.sco_utils as scu, sco_version, requests
from flask import g
from flask_login import current_user
import requests
import app.scodoc.sco_utils as scu
import sco_version
from app import log
from app.scodoc.sco_exceptions import ScoValueError
from app.scodoc.sco_dump_db import sco_dump_and_send_db
from app.scodoc.sco_exceptions import ScoValueError
def sco_bug_report(
title: str = "", message: str = "", etab: str = "", include_dump: bool = False
) -> requests.Response:
"""Envoi d'un bug report (ticket)"""
dump_id = None
if include_dump:
@ -56,8 +60,9 @@ def sco_bug_report(
try:
dump_id = dump.json()["dump_id"]
except (requests.exceptions.JSONDecodeError, KeyError):
dump_id = "inconnu"
dump_id = "inconnu (erreur)"
log(f"sco_bug_report: {scu.SCO_BUG_REPORT_URL} by {current_user.user_name}")
try:
r = requests.post(
scu.SCO_BUG_REPORT_URL,

View File

@ -297,7 +297,10 @@ div.effectif {
rel="noopener noreferrer">Contact (Discord)</a>
</li>
<li>
<a class="stdlink" href="sco_bug_report">Créer un ticket</a>
<a class="stdlink" href="sco_dump_and_send_db">Envoyer données</a>
</li>
<li>
<a class="stdlink" href="sco_bug_report">Signaler une erreur ou suggérer une amélioration</a>
</li>
</ul>
</div>

View File

@ -2571,7 +2571,7 @@ def sco_bug_report_form():
form = CreateBugReport()
if request.method == "POST" and form.cancel.data: # cancel button
return redirect(url_for("scodoc.index"))
return flask.redirect(url_for("scodoc.index"))
if form.validate_on_submit():
r = sco_bug_report.sco_bug_report(
form.title.data, form.message.data, form.etab.data, form.include_dump.data
@ -2581,15 +2581,11 @@ def sco_bug_report_form():
try:
r_msg = r.json()["message"]
except (requests.exceptions.JSONDecodeError, KeyError):
r_msg = (
"Erreur: code <tt>"
+ str(status_code)
+ '</tt> Merci de contacter <a href="mailto:'
+ scu.SCO_DEV_MAIL
+ '">'
+ scu.SCO_DEV_MAIL
+ "</a>"
)
log(f"sco_bug_report: error {status_code}")
r_msg = f"""Erreur: code <tt>{status_code}</tt>
Merci de contacter
<a href="mailto:{scu.SCO_DEV_MAIL}">{scu.SCO_DEV_MAIL}</a>
"""
H = [html_sco_header.sco_header(page_title="Assistance technique")]
if r.status_code >= 200 and r.status_code < 300: