feat: restrict user answer compaction to admin users and update related tests
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% if request.user.is_superuser or request.user.is_staff %}
|
||||
<!-- Compacting tools panel -->
|
||||
<div class="card mt-4 border-warning">
|
||||
<div class="card-header bg-warning-subtle text-warning-emphasis fw-bold">
|
||||
@@ -76,14 +77,6 @@
|
||||
Compacting history deletes all older versions and their associated revision logs, retaining only the final answer database state. This is permanent and cannot be undone.
|
||||
</p>
|
||||
<div class="d-flex flex-wrap gap-3">
|
||||
<form method="post" style="display:inline;">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="compact_single">
|
||||
<button type="submit" class="btn btn-warning btn-sm" onclick="return confirm('Are you sure you want to delete all historical edits for this individual answer?');">
|
||||
Compact Single Answer
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{% if exam or collection %}
|
||||
<form method="post" style="display:inline;">
|
||||
{% csrf_token %}
|
||||
@@ -96,6 +89,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="d-flex justify-content-between mt-4">
|
||||
<button type="button" class="btn btn-secondary" onclick="window.history.back();">Back</button>
|
||||
|
||||
Reference in New Issue
Block a user