Compare commits

..
Author SHA1 Message Date
dependabot[bot] c24c0d3ac4 [UPDATE] Update model-bakery requirement
Updates the requirements on [model-bakery](https://github.com/model-bakers/model_bakery) to permit the latest version.
- [Release notes](https://github.com/model-bakers/model_bakery/releases)
- [Changelog](https://github.com/model-bakers/model_bakery/blob/main/CHANGELOG.md)
- [Commits](https://github.com/model-bakers/model_bakery/compare/1.24.1...1.24.2)

---
updated-dependencies:
- dependency-name: model-bakery
  dependency-version: 1.24.2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-13 00:34:14 +00:00
thomas girod b560c6860b Merge pull request #1510 from ae-utbm/forum-message-403
short-circuit `ForumMessageView` redirection on 403
2026-10-13 00:12:07 +02:00
imperosol 22b510e25b short-circuit ForumMessageView redirection on 403
Quand on accède à cette vue, on est immédiatement redirigé vers le topic correspondant (quitte à se faire 403 une fois arrivé là). Comme la redirection est une opération qui a un cout, on peut gagner du temps en mettant un PermissionDenied directement (d'autant plus que les bots aiment beaucoup rechercher les messages du forum, et qu'ils se font systématiquement 403)
2026-10-09 16:09:54 +02:00
4 changed files with 11 additions and 8 deletions

No files matched your search

+5 -2
View File
@@ -346,13 +346,16 @@ class ForumTopicDetailView(CanViewMixin, DetailView):
return kwargs
class ForumMessageView(SingleObjectMixin, RedirectView):
class ForumMessageView(SingleObjectMixin, UserPassesTestMixin, RedirectView):
model = ForumMessage
pk_url_kwarg = "message_id"
permanent = False
def get_redirect_url(self, *args, **kwargs):
def test_func(self) -> bool:
self.object = self.get_object()
return self.request.user.can_view(self.object)
def get_redirect_url(self, *args, **kwargs):
return self.object.get_url()
+4 -4
View File
@@ -54,7 +54,7 @@
"@typescript/native": "npm:typescript@^7.0.2",
"rollup-plugin-visualizer": "^7.1.1",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.3.3"
"vite": "^8.3.2"
}
},
"node_modules/@ae_utbm/aemark": {
@@ -5168,9 +5168,9 @@
}
},
"node_modules/vite": {
"version": "8.3.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.3.tgz",
"integrity": "sha512-cTAldKPImjg6c+gk48U19POPn3GCBzZwpdsN8ZMEEcbpes+6/wvfqUd0C2y3qYY4wsj8PwgFwrZ/1jBPVttMSg==",
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.2.tgz",
"integrity": "sha512-SQr1x6W5vVSbROg7vsyXIaxK9b0G7zsT68acdWWRmnBUsgDieLCRG+Rep9WdZgcposvv/GSnr4GUUBqB3vXq6w==",
"dev": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -37,7 +37,7 @@
"@typescript/native": "npm:typescript@^7.0.2",
"rollup-plugin-visualizer": "^7.1.1",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.3.3"
"vite": "^8.3.2"
},
"dependencies": {
"@ae_utbm/aemark": "^0.1.3",
+1 -1
View File
@@ -76,7 +76,7 @@ tests = [
"pytest>=9.1.1,<10.0.0",
"pytest-cov>=7.1.0,<8.0.0",
"pytest-django>=4.14.0,<5.0.0",
"model-bakery>=1.24.1,<2.0.0",
"model-bakery>=1.24.2,<2.0.0",
"beautifulsoup4>=4.15.0,<5",
"lxml>=6.1.3,<7",
]