Commit Graph

999 Commits

Author SHA1 Message Date
thomas girod
d3b203a4a1 change cache on picture download 2024-08-08 11:50:45 +02:00
thomas girod
da6bd84cdf restify album view 2024-08-08 11:50:45 +02:00
thomas girod
0b9ccf6a57 paginate GET /api/sas/picture 2024-08-08 11:50:45 +02:00
thomas girod
62bb15317c T2 ruff rule 2024-08-06 11:42:10 +02:00
thomas girod
996dadf6f5 update alpineJS to 3.14 2024-08-05 17:16:24 +02:00
thomas girod
29bb0f6712 promote AlpineJS to global dependency 2024-08-05 17:08:30 +02:00
thomas girod
a637742bb0 apply review comment 2024-08-05 10:52:15 +02:00
thomas girod
a5e4db99fb Use X-Accel-Redirect to send files in prod 2024-08-05 10:52:15 +02:00
thomas girod
a9f66e2cd9 extract sent_from_logged_counter(request) 2024-08-05 10:52:15 +02:00
Sli
181e74b1d1 Add antispam app
* update_spam_database command to update suspicious domains from an
   external provider
* Add a AntiSpamEmailField that deny emails from suspicious domains
* Update documentation
2024-08-04 22:34:40 +02:00
thomas girod
946f35c601
Merge pull request #752 from ae-utbm/autocomplete-admin
use autocomplete_fields in admin
2024-08-01 13:01:27 +02:00
thomas girod
eef15e05f4 use autocomplete_fields in admin 2024-08-01 11:27:54 +02:00
Sli
f265346a10 Sort pictures by album in zip file 2024-07-31 12:01:08 +02:00
thomas girod
819e2b5f9f better download button style 2024-07-30 19:58:58 +02:00
thomas girod
91344741a5 add some alpine to picture download 2024-07-30 19:23:48 +02:00
Sli
ffa3936878 Improve zip download
* Remove jszip for zip.js which is better maintained
* Pictures keep their creation date
2024-07-30 11:11:31 +02:00
Sli
3304f32ef0 Add image download progress bar and fix output name of pictures 2024-07-28 23:53:18 +02:00
thomas girod
39151b61e7
Merge pull request #741 from ae-utbm/better-pagination
improve pagination
2024-07-28 16:46:00 +02:00
thomas girod
3f49d70745 remove pedagogy style from style.scss 2024-07-28 16:39:15 +02:00
thomas girod
e5434961de
Merge pull request #736 from ae-utbm/better-scss
Better scss
2024-07-28 16:35:12 +02:00
thomas girod
b022ebb80e improve pagination 2024-07-27 10:46:57 +02:00
thomas girod
2737cae4ab update django-phonenumber-field 2024-07-26 21:45:18 +02:00
thomas girod
63b6b262c6 repair BASE_DIR 2024-07-26 18:21:57 +02:00
thomas girod
424639ea80 better scss 2024-07-26 15:55:15 +02:00
thomas girod
594776f3a6 better scss compilation 2024-07-26 15:55:15 +02:00
thomas girod
6c4251a91f populate more 2024-07-26 15:15:50 +02:00
thomas girod
2261782920
Merge pull request #738 from ae-utbm/fix-remove-from-picture
Fix button to remove a user from picture
2024-07-26 14:48:28 +02:00
thomas girod
3c76c5e0f1 fix grouping 2024-07-26 00:39:29 +02:00
thomas girod
d348e6314a fix the pictures order (not just the album) 2024-07-26 00:39:29 +02:00
thomas girod
b3fa6f352b fix album order for user pictures 2024-07-26 00:39:29 +02:00
thomas girod
215fdce411 Fix button to remove a user from picture 2024-07-25 23:29:12 +02:00
thomas girod
b25805e0a1 introduce djhtml as jinja+scss formater 2024-07-25 16:46:45 +02:00
Sli
15f51fb03f Create an NFC button for browser supporting NFC API 2024-07-25 07:18:39 +02:00
thomas girod
a24b1f5c2a
Merge pull request #730 from ae-utbm/picture-zip
Téléchargement des images dans un zip
2024-07-25 01:21:02 +02:00
thomas girod
04e7f65e8e
Merge pull request #725 from ae-utbm/drop-jquery-calendar
Remove jquery datetimepicker
2024-07-25 01:20:41 +02:00
Sli
41b9318028 Download user pictures as a zip 2024-07-24 23:51:15 +02:00
thomas girod
d51dbf8a53
Merge pull request #724 from ae-utbm/ninja
Use django-ninja for the API
2024-07-24 00:48:08 +02:00
thomas girod
c03a1b57c5 update doc 2024-07-24 00:44:09 +02:00
thomas girod
9295325d21 remove jquery datetime picker 2024-07-23 23:26:48 +02:00
thomas girod
cb1aa8bef0 add tests 2024-07-23 20:36:57 +02:00
Sli
b9d19be183 Fix markdown api and add test for user picture page 2024-07-23 20:36:46 +02:00
Sli
293369f165 Pagination on UV guide 2024-07-23 19:58:11 +02:00
thomas girod
3046438cb1 replace drf by django-ninja 2024-07-23 19:57:33 +02:00
Sli
c7f8cdd098 Support field_name argument in honeypot jinja extension 2024-07-22 11:34:22 +02:00
Sli
58ff5b934a add get_client_ip util function 2024-07-22 09:49:08 +02:00
thomas girod
82d3791859 refactor counter 2024-07-21 10:51:08 +02:00
thomas girod
8c69a94488 use google convention for docstrings 2024-07-21 00:57:04 +02:00
thomas girod
07b625d4aa Rewrite documentation with MkDocs 2024-07-21 00:56:58 +02:00
thomas girod
8245ddf2a6 fix font for code blocks in markdown 2024-07-18 14:51:50 +02:00
Sli
bad67a8b65 Add promo 24 logo 2024-07-16 00:25:50 +02:00
Sli
0fb61938ce Reorganize honeypot settings 2024-07-11 10:49:08 +02:00
Sli
d6b27f2f21 Make honeypot errors less suspicious 2024-07-10 19:30:01 +02:00
thomas girod
e15bcfae07 Send an email when creating an account via POST /register 2024-07-10 17:21:07 +02:00
Sli
72cf5a3d5e Introduce honeypot for login/registering/password changing 2024-07-10 14:51:39 +02:00
thomas girod
7f6c4f6236 change sup and sub in mde editor 2024-07-08 17:04:18 +02:00
thomas girod
30948f1701 better style for rendered markdown 2024-07-08 15:56:38 +02:00
thomas girod
02ec3607b2 fix install_xapian.sh 2024-07-08 15:56:37 +02:00
thomas girod
3c2dcfbfa2 update mistune 2024-07-08 15:56:37 +02:00
thomas girod
c6d2ac9100 ruff rule B 2024-07-08 15:37:10 +02:00
thomas girod
2ac578c3ad ruff rule DJ
Co-authored-by: Bartuccio Antoine <klmp200@users.noreply.github.com>
2024-07-08 15:37:10 +02:00
thomas girod
f941435232 ruff rule C4 2024-07-08 15:37:10 +02:00
thomas girod
171a1cb876 ruff rule FBT 2024-07-08 15:37:09 +02:00
thomas girod
cfc19434d0 ruff rules UP008 and UP009 2024-07-08 15:37:09 +02:00
thomas girod
688871a680 ruff rule A 2024-07-08 15:37:08 +02:00
thomas girod
aa07fa9207 faster tests 2024-07-04 14:03:19 +02:00
thomas girod
ea8247aa16 fix broken translations 2024-07-04 11:31:36 +02:00
thomas girod
bf18284450 apply forgotten migrations 2024-07-04 11:31:36 +02:00
thomas girod
cd58d5a357 resolve warnings 2024-07-04 11:31:35 +02:00
thomas girod
d97602e60b
Use pytest for tests (#681)
* use pytest for tests

Eh ouais, il y a que la config qui change. Pytest est implémentable par étapes. Et ça c'est beau.

* rework tests with pytest

* remove unittest custom TestRunner

* Edit doc and CI
2024-06-26 19:10:24 +02:00
thomas girod
3143d3d91a reorganize imports with ruff 2024-06-26 12:35:38 +02:00
thomas girod
9bdf3fc4ac use ruff for formating
Co-authored-by: Bartuccio Antoine <klmp200@users.noreply.github.com>
2024-06-26 12:35:14 +02:00
Sli
ca27b89a8b Apply shellcheck on install_xapian.sh 2024-06-26 11:31:39 +02:00
Sli
e1bf7caa9a Fix CVE-2023-31047 2024-06-24 13:27:22 +02:00
Sli
5416d88c97 Upgrade dependencies and install xapian from sources 2024-06-24 13:26:58 +02:00
Julien Constant
d16bf12611
Links update & translations typos fixes (#671)
* Remove BDF link (as BDF is now part of AE)

* Remove unused pages

* Fix typos

* Fix typo again
2023-10-10 15:29:02 +02:00
thomas girod
aaf30ab965
Add missing method on AnonymousUser (#649) 2023-09-07 23:53:42 +02:00
Julien Constant
38295e591d
Fix immutable default variable in get_start_of_semester (#656)
Le serveur ne percevait pas le changement de semestre, parce
que la valeur par défaut passée à la fonction `get_start_of_semester()` était une fonction appelée une seule fois, lors du lancement du serveur. Bref, c'était ça : https://beta.ruff.rs/docs/rules/function-call-in-default-argument/

---------

Co-authored-by: imperosol <thgirod@hotmail.com>
2023-09-07 23:11:58 +02:00
Julien Constant
84768eb74e
[FIX] Fix cached groups (#647) 2023-05-12 13:27:51 +02:00
Skia
87295ad9b7
Galaxy improvements (#628)
* galaxy: improve logging and performance reporting

* galaxy: add a full galaxy state test

* galaxy: optimize user self score computation

* galaxy: add 'generate_galaxy_test_data' command for development at scale

* galaxy: big refactor

Main changes:
  - Multiple Galaxy objects can now exist at the same time in DB. This allows for ruling a new galaxy while still
    displaying the old one.
  - The criteria to quickly know whether a user is a possible citizen is now a simple query on picture count. This
    avoids a very complicated query to database, that could often result in huge working memory load. With this change,
    it should be possible to run the galaxy even on a vanilla Postgres that didn't receive fine tuning for the Sith's
    galaxy.

* galaxy: template: make the galaxy graph work and be usable with a lot of stars

- Display focused star and its connections clearly
- Display star label faintly by default for other stars to avoid overloading the graph
- Hide non-focused lanes
- Avoid clicks on non-highlighted, too far stars
- Make the canva adapt its width to initial screen size, doesn't work dynamically

* galaxy: better docstrings

* galaxy: use bulk_create whenever possible

This is a big performance gain, especially for the tests.

Examples:

----

`./manage.py test galaxy.tests.GalaxyTest.test_full_galaxy_state`

Measurements averaged over 3 run on *my machine*™:
Before: 2min15s
After: 1m41s

----

`./manage.py generate_galaxy_test_data --user-pack-count 1`

Before: 48s
After: 25s

----

`./manage.py rule_galaxy` (for 600 citizen, corresponding to 1 user-pack)

Before: 14m4s
After: 12m34s

* core: populate: use a less ambiguous 'timezone.now()'

When running the tests around midnight, the day is changing, leading to some values being offset to the next day
depending on the timezone, and making some tests to fail. This ensure to use a less ambiguous `now` when populating
the database.

* write more extensive documentation

- add documentation to previously documented classes and functions and refactor some of the documented one, in accordance to the PEP257 and ReStructuredText standards ;
- add some type hints ;
- use a NamedTuple for the `Galaxy.compute_users_score` method instead of a raw tuple. Also change a little bit the logic in the function which call the latter ;
- add some additional parameter checks on a few functions ;
- change a little bit the logic of the log level setting for the galaxy related commands.

* galaxy: tests: split Model and View for more efficient data usage

---------

Co-authored-by: maréchal <thgirod@hotmail.com>
2023-05-10 12:47:02 +02:00
Julien Constant
5ab5ef681c
Remove duplicated css 2023-05-09 23:08:32 +02:00
Julien Constant
c9e70889dd
Merge branch 'master' into taiste 2023-05-09 22:37:49 +02:00
Julien Constant
b30ee0a27a
[FIX] Correction de bugs (#617)
* Fix #600

* Fix #602

* Fixes & améliorations du nouveau CSS (#616)

* Fix #604

* should fix #605

* Fix #608

* Update core/views/site.py

Co-Authored-By: thomas girod <56346771+imperosol@users.noreply.github.com>

* Added back the permission denied

* Should fix #609

* Fix failing test when 2 user are merged

* Should fix #610

* Should fix #627

* Should fix #109

Block les URLs suivantes lorsque le fichier se trouve dans le dir `profiles` ou `SAS` :
- `/file/<id>/`
- `/file/<id>/[delete|prop|edit]`

> Les urls du SAS restent accessiblent pour les roots & les admins SAS
> Les urls de profiles sont uniquement accessiblent aux roots

* Fix root dir of SAS being unnaccessible for sas admins

⚠️ need to edit the SAS directory & save it (no changes required in sas directory properties)

* Remove overwritten code

* Should fix duplicated albums in user profile (wtf)

* Fix typo

* Extended profiles picture access to board members

* Should fix #607

* Fix keyboard navigation not working properly

* Fix user tagged pictures section inside python rather than in the template

* Update utils.py

* Apply suggested changes

* Fix #604

* Fix #608

* Added back the permission denied

* Should fix duplicated albums in user profile (wtf)

* Fix user tagged pictures section inside python rather than in the template

* Apply suggested changes

---------

Co-authored-by: thomas girod <56346771+imperosol@users.noreply.github.com>
2023-05-02 13:07:36 +02:00
thomas girod
ef968f3673
Better usage of cache for groups and clubs related operations (#634)
* Better usage of cache for group retrieval

* Cache clearing on object deletion or update

* replace signals by save and delete override

* add is_anonymous check in is_owned_by

Add in many is_owned_by(self, user) methods that user is not anonymous. Since many of those functions do db queries, this should reduce a little bit the load of the db.

* Stricter usage of User.is_in_group

Constrain the parameters that can be passed to the function to make sure only a str or an int can be used. Also force to explicitly specify if the group id or the group name is used.

* write test and correct bugs

* remove forgotten populate commands

* Correct test
2023-05-02 12:36:59 +02:00
thomas girod
96dede5077
Speed up tests (#638) 2023-05-02 11:00:23 +02:00
thomas girod
b5a40cfda9
Mise à jour de Black vers la version 23.3 (#629) 2023-04-22 15:32:31 +02:00
Julien Constant
c1022642a2 [FIX] Fixes supplémentaires pour la màj de mars (#622)
- Les photos de l'onglet de la page utilisateur utilise désormais leur version thumbnail au lieu de leur version HD
- Une des classes du CSS du SAS a été renommée car elle empiétait sur une class de la navbar
- Le profil utilisateur a été revu pour ajouter plus d'espacement entre le tableau des cotisations et le numéro de cotisants
- Les images de forum & blouse sont de nouveau cliquable pour les afficher en grands
- Sur mobile, lorsqu'on cliquait sur le premier élément de la navbar, ce dernier avait un overlay avec des angles arrondis
- Sur mobile, les utilisateurs avec des images de profils non carrées dépassait dans l'onglet Famille
2023-04-08 20:59:43 +02:00
Julien Constant
910a6f8b34
[FIX] Fixes supplémentaires pour la màj de mars (#622)
- Les photos de l'onglet de la page utilisateur utilise désormais leur version thumbnail au lieu de leur version HD
- Une des classes du CSS du SAS a été renommée car elle empiétait sur une class de la navbar
- Le profil utilisateur a été revu pour ajouter plus d'espacement entre le tableau des cotisations et le numéro de cotisants
- Les images de forum & blouse sont de nouveau cliquable pour les afficher en grands
- Sur mobile, lorsqu'on cliquait sur le premier élément de la navbar, ce dernier avait un overlay avec des angles arrondis
- Sur mobile, les utilisateurs avec des images de profils non carrées dépassait dans l'onglet Famille
2023-04-08 20:58:55 +02:00
Julien Constant
fa6527b24f
[FIX] Deuxième vague de fixes pour la mise à jour de mars (#619) 2023-04-06 16:09:29 +02:00
Julien Constant
0501e6417a
Merge branch 'master' into taiste 2023-04-05 20:02:12 +02:00
Julien Constant
a198f5252d
Fixes & améliorations du nouveau CSS (#616) 2023-04-05 18:03:43 +02:00
Julien Constant
d83842af27
Fix problème de cache dans le SAS & améliore le CSS du SAS
Co-authored-by: Bartuccio Antoine <klmp200@users.noreply.github.com>
2023-04-05 14:32:32 +02:00
Julien Constant
f605f7dcc6
Fixes pour la mise à jour de mars (#598) 2023-04-04 22:55:26 +02:00
Julien Constant
e638bc04ed
Fixes pour la mise à jour de mars (#598) 2023-04-04 22:50:19 +02:00
Julien Constant
4830c3ea2d
Mise à jour de mars (#586)
---------

Co-authored-by: Thomas Girod <thgirod@hotmail.com>
Co-authored-by: Théo DURR <git@theodurr.fr>
2023-04-04 19:17:44 +02:00
Julien Constant
8e7c025e47
[FIX] Broken link in readme and license fix (& update) (#591) 2023-04-04 18:39:45 +02:00
Julien Constant
1bfe929ab3
[CSS] Follow up of #578 (#589) 2023-04-04 15:21:09 +02:00
Julien Constant
1f10a284f2
Added GA/Clubs Google Calendar to main page (#585)
* Added GA/Clubs google calendar to main page

* Made tables full width
2023-04-03 15:54:12 +02:00
Julien Constant
28f397574f
Amélioration des pages utilisateurs pour les petits écrans (#578, #520)
- Refonte de l'organisation des pages utilisateurs (principalement du front)
  - Page des parrains/fillots
  - Page d'édition du profil
  - Page du profil
  - Page des outils
  - Page des préférences
  - Page des stats utilisateurs

- Refonte du CSS / organisation de la navbar principale (en haut de l'écran)
- Refonte du CSS de la navbar bleu clair (le menu)
- Refonte du CSS du SAS :
  - Page de photo
  - Page d'albums
2023-03-30 14:38:40 +02:00
thomas girod
6c1fa6de0b
remove-useless-queries-counter-stats (#519) 2023-03-24 15:32:05 +01:00
Théo DURR
dd3ad42eb5
Mise à jour de février (#581)
Co-authored-by: Thomas Girod <thgirod@hotmail.com>
Co-authored-by: Julien Constant <julienconstant190@gmail.com>
Co-authored-by: Skia <skia@hya.sk>
2023-03-09 13:39:33 +01:00