-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensemble d'améliorations sur la page listant les alertes (#6671)
* Améliore la zone d'admin pour les alertes * Supprime les alertes concernant les commentaires de contenus supprimés Un billet peut être dépublié puis supprimé par son auteurice, si ce billet avait des commentaires avec des alertes, ces alertes n'étaient pas supprimées, ce qui levait une exception lorsqu'on allait sur la page des alertes. On supprime maintenant les alertes lorsque l'élément qu'elles concernent est supprimé. Problème rapporté par Sentry. * Homogénéise les scopes des alertes en base de données * Précise mieux sur la page des alertes sur quel type d'élément porte l'alerte * N'affiche pas de lien vers un commentaire signalé inaccessible sur la page des alertes S'il y avait une alerte sur un contenu dépublié, l'alerte était toujours listée sur la page des alertes, mais avec un lien vers le commentaire signalé mal formé, puisqu'il était de la forme pages/alertes/?page=1&#p123.
- Loading branch information
1 parent
1a6e95c
commit c0cef18
Showing
7 changed files
with
180 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Generated by Django 4.2.16 on 2024-10-20 16:28 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("tutorialv2", "0041_remove_must_reindex"), | ||
("utils", "0027_remove_update_index_date"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="alert", | ||
name="comment", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="alerts_on_this_comment", | ||
to="utils.comment", | ||
verbose_name="Commentaire", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="alert", | ||
name="content", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="alerts_on_this_content", | ||
to="tutorialv2.publishablecontent", | ||
verbose_name="Contenu", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 4.2.16 on 2024-10-19 22:55 | ||
|
||
""" | ||
In production, the column `scope` of the table containg the alerts contains | ||
leftovers from older alert management: | ||
SELECT BINARY scope, COUNT(*) AS nb, MIN(pubdate) AS first_pubdate, MAX(pubdate) AS last_pubdate FROM utils_alert WHERE solved=1 GROUP BY BINARY scope; | ||
+--------------+------+---------------------+---------------------+ | ||
| BINARY scope | nb | first_pubdate | last_pubdate | | ||
+--------------+------+---------------------+---------------------+ | ||
| ARTICLE | 113 | 2017-05-15 11:03:23 | 2024-09-04 10:09:20 | | ||
| Article | 5 | 2017-01-24 21:34:56 | 2017-04-20 15:56:43 | | ||
| CONTENT | 115 | 2017-05-04 12:28:11 | 2024-08-08 08:46:31 | | ||
| FORUM | 3756 | 2016-12-13 19:03:00 | 2024-09-15 22:37:04 | | ||
| OPINION | 202 | 2017-05-21 14:28:24 | 2024-09-04 15:20:13 | | ||
| PROFILE | 1088 | 2019-09-18 22:16:55 | 2024-09-16 17:39:55 | | ||
| TUTORIAL | 392 | 2017-05-21 21:48:11 | 2024-09-12 20:07:01 | | ||
| Tutoriel | 7 | 2016-12-21 22:56:29 | 2017-04-26 12:21:32 | | ||
+--------------+------+---------------------+---------------------+ | ||
This migration normalizes the scope values of all alerts. | ||
""" | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("utils", "0028_alert_cascade_delete"), | ||
] | ||
|
||
operations = [ | ||
# These WHERE are actually case *in*sensitive, but it will not change | ||
# the result (just modify more records which don't need it), but | ||
# having a WHERE which is case-sensitive *and* compatible with both | ||
# SQLite and MariaDB seems tricky... | ||
migrations.RunSQL( | ||
("UPDATE utils_alert SET scope = 'ARTICLE' WHERE scope = 'Article';"), | ||
), | ||
migrations.RunSQL( | ||
("UPDATE utils_alert SET scope = 'TUTORIAL' WHERE scope = 'Tutoriel';"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters