Skip to content

Account and comment management#40

Merged
raynaldlao merged 9 commits into
masterfrom
account-comment-management
Jul 17, 2026
Merged

Account and comment management#40
raynaldlao merged 9 commits into
masterfrom
account-comment-management

Conversation

@raynaldlao

@raynaldlao raynaldlao commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Contexte

Gestion complète des comptes utilisateurs — modification email/mot de passe, promotion de rôle par l'admin, suppression de compte, et modération des commentaires imbriqués — implémentée via l'architecture hexagonale.

Modifications

Compte utilisateur

  • Modification email — nouveau flux hexagonal (port → service → adaptateur), modale légère sur la page profil, 17 tests
  • Modification mot de passe — même motif, avec bouton œil pour afficher/masquer (password-toggle.js)
  • Placeholders formulaires — unifiés avec exemples concrets (dev_journey, MyP@ssw0rd!) sur login, inscription et profil
  • Suppression de compte — suppression physique, FK SET NULL sur les articles (anonymisés "Anonymous"), FK CASCADE sur les commentaires. Migration V11. 10 nouveaux tests

Administration

  • Gestion des rôlesupdate_account_role avec validation (admin requis, cible existante, cible non-admin, rôle valide). Sélecteur inline sur la page profil + tableau des utilisateurs, styles cohérents. 10 nouveaux tests
  • Tableau utilisateurs — colonne "Actions", sélecteur/Update/Delete alignés en flex-row, compact sur mobile

Commentaires

  • Profondeur max — limitée à 3, réponses désactivées à partir de ≥ 3
  • Suppression en cascadeorphan_children supprimé, la suppression cascade toujours via _delete_with_descendants()
  • Anonymisation — commentaires des utilisateurs supprimés conservés avec "Comment removed" et avatar par défaut

Sécurité

  • Tests XSS — unitaire (prosemirror_to_html échappe <script>) + intégration (pipeline HTTP complet avec payload BlockNote JSON)

Refactor

  • Dialogue de confirmation globalisé dans base.html, styles .dialog déplacés dans base.css
  • CSS mort supprimé : .detail-body, .article-form-actions, .article-form-btn, .comment-reply-input
  • Vue commentaire refactorée — logique des formulaires de réponse, affichage de la profondeur, bascule de visibilité

…l modal on the profile page. Introduces the hexagonal update flow (ports, service, adapters) and a new POST /profile/email route. The profile shows the email with an Edit button opening the modal. CSS + `profile-email.js` handle layout and behavior. Tests cover service, adapters and the full integration path
…es with two lightweight profile modals. New ports, service methods, adapters and Flask routes support both updates. Profile UI gains two small modals and minor styling tweaks. Seventeen tests cover the full update flow
…the profile’s password modal. The new password field is wrapped in a `.password-wrapper` with a toggle button, styled in `profile.css` and the existing `password-toggle.js` is now loaded on the profile page
…h clear “e.g.” examples. Replace vague placeholders with concrete samples (e.g., `dev_journey`, `MyP@ssw0rd!`), add the missing one in the profile email modal and apply the same pattern across login registration and profile forms
…ents via SET NULL. Deleted users’ comments stay visible as “Anonymous / Comment removed”. Author IDs become nullable across domain, DTOs and models, and services/templates handle the Anonymous fallback. Migration V11 updates the FK. Routes, views, CSS and adapters are adjusted. Ten new tests cover DTOs, services, Flask adapter and integration
…. Replies are disabled from depth ≥ 3, and DTOs stop returning deeper children. Sorting is unified to newest‑first and nullable author IDs are handled across services and tree building. Tests cover truncation, depth logic and HTML output
…Note article content. Unit test verifies that `prosemirror_to_html` escapes `<script>` inside paragraph text. Integration test confirms the full HTTP pipeline safely renders BlockNote JSON containing an XSS payload
…th and drop the cascade parameter from comment deletion. delete_comment now always cascades descendants through _delete_with_descendants, matching real frontend behavior. Ports, services, adapters, template and tests are updated accordingly
…e promotion/demotion. Backend gains a validated update_account_role flow with new ports, service logic and a POST /admin/users/<id>/role route. Adapters implement update_role, and the profile page plus user list get an inline role selector for admins. CSS updates align the new forms
@raynaldlao
raynaldlao requested a review from hlargitte July 17, 2026 16:34
@raynaldlao raynaldlao self-assigned this Jul 17, 2026
@raynaldlao
raynaldlao merged commit c1a017b into master Jul 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant