Editor-created subdocuments not appearing in trash after deletion

Open
#2,571 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
django, python

Research direction

No files or tests are named in the issue. Start by tracing the subdocument deletion and trash/ownership paths in the Django backend, then add or run coverage for editor-created subdocuments; done means the reproducer places the deleted subdocument in User B's trash without changing owner-created behavior.

Written by the indexing model from the issue text.

Description

backend bug

Bug Report

Problematic behavior
When a user with editor permissions (not the owner) creates a subdocument within a document and then deletes it, the subdocument does not appear in their trash. This behavior is inconsistent with what he is prompted in the delete modal.

Expected behavior/code
Any subdocument created by a user, even within a document they only have editor permissions for, should be treated as their property. Deleting such a subdocument should move it to the user's trash.

Steps to Reproduce

  1. User A owns a document.
  2. User B (editor) creates a subdocument within User A's document.
  3. User B deletes the subdocument they created.
  4. The deleted subdocument does not appear in User B's trash.

Environment

  • Docs version: 5.4.1
  • Instance URL: docs.numerique.gouv.fr

Possible Solution
The system should recognize that subdocuments created by a user are their property, regardless of their role in the parent document. Deleting such subdocuments should move them to the user's trash.

Additional context/Screenshots

  • This issue affects users who are not owners but have editor permissions.
  • Clarifying ownership rules for subdocuments created by editors could resolve this inconsistency.

https://github.com/user-attachments/assets/dc77c8db-c072-484b-8383-1649e96df047

Dominant language
Python
Stars
16.8k
Forks
638
Avg merge
1d 15h
Merged PRs (30d)
40

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from suitenumerique/docs

All issues in suitenumerique/docs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.