61 lines
2.9 KiB
HTML
61 lines
2.9 KiB
HTML
<div class="docs-content" data-render>
|
|
# Media moderation
|
|
|
|
> Audience: administrators. This page is hidden from members and guests in the sidebar, the search
|
|
> index, and the documentation export. It describes the soft-delete mechanics and the moderation
|
|
> tools behind the profile [Media gallery](/docs/media-gallery.html).
|
|
|
|
DevPlace never hard-deletes an attachment when a user removes it. Deletion is a **soft delete**: the
|
|
database row, the file on disk, and the attachment's link to its parent object are all kept intact,
|
|
and the item simply disappears from every place it was shown. Every deletion is therefore reversible
|
|
and leaves a moderation trail.
|
|
|
|
## What a delete actually does
|
|
|
|
When a member deletes one of their own uploads (or an admin deletes anyone's), the attachment row
|
|
gets a `deleted_at` timestamp. Nothing else changes:
|
|
|
|
- the file stays on disk,
|
|
- the `target_type` / `target_uid` relation to the parent post, project, gist, comment, message,
|
|
issue, or news item is preserved,
|
|
- the item vanishes from the owner's Media tab **and** from the parent object it was attached to.
|
|
|
|
Because the relation is never cleared, restoring is a single step: clear `deleted_at` and the
|
|
attachment reappears in the gallery and on its original parent object, with no re-linking.
|
|
|
|
## Who can do what
|
|
|
|
| Action | Who | Effect |
|
|
|--------|-----|--------|
|
|
| Delete media | The uploader, or any admin | Soft delete (reversible) |
|
|
| Restore media | Admin only | Brings a soft-deleted item back everywhere |
|
|
| Purge media | Admin only | Permanent hard delete (row + file) |
|
|
|
|
Members and guests are never shown the soft-delete, restore, or purge concepts; to them a delete
|
|
simply removes the item. Moderation is an administrator surface.
|
|
|
|
## The Media trash
|
|
|
|
The **Media** entry in the admin sidebar opens `/admin/media`: every soft-deleted attachment across
|
|
all users, newest first, with its uploader and the time it was deleted. From here you can:
|
|
|
|
- **Restore** an item (`POST /media/{uid}/restore`) - it returns to the owner's gallery and to its
|
|
parent object immediately.
|
|
- **Purge** an item (`POST /admin/media/{uid}/purge`) - a permanent hard delete that removes the
|
|
database row and deletes the file from disk. This cannot be undone and is the only way media is
|
|
hard-deleted from the UI.
|
|
|
|
## Invariant: parent deletion still cleans up files
|
|
|
|
Soft delete only affects the per-attachment delete path. When a whole parent object is permanently
|
|
deleted (for example a project), its attachments are still hard-deleted, including any already
|
|
soft-deleted, so files are never orphaned. The display filters that hide soft-deleted media are
|
|
deliberately not applied to that cascade.
|
|
|
|
## Reference
|
|
|
|
- API: [Media trash, restore, and purge](/docs/admin.html) on the Admin API page; the member-facing
|
|
[delete endpoint](/docs/profiles.html) is on the Profiles page.
|
|
- Devii operates the member-facing delete (`delete_media`); restore and purge are admin UI only.
|
|
</div>
|