Stop scheduled prunes at the quota target
Pruning previously deleted every photo in the plan; it now halts once usage is back under the cleanup target, so a plan computed earlier cannot over-delete. If the library is already below target the cleanup is cancelled and the owner is notified instead. Notification emails also skip the "open Luminary" link when no public URL is configured, and the admin panel keys the prune action off the plan's freed bytes rather than the warning flag. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -292,8 +292,8 @@ export default function AdminPanel({ user, onClose, onChanged, onRestored }: Pro
|
||||
};
|
||||
|
||||
const scheduleQuotaPrune = (quota: AdminQuota) => {
|
||||
if (!quota.warn) {
|
||||
setError('This account only needs a prune after it reaches the warning threshold');
|
||||
if (quota.plan.freedBytes <= 0) {
|
||||
setError('There is nothing old enough to prune. The account is already below the cleanup target');
|
||||
return;
|
||||
}
|
||||
if (!overview?.mail.configured) {
|
||||
@@ -889,12 +889,12 @@ export default function AdminPanel({ user, onClose, onChanged, onRestored }: Pro
|
||||
) : (
|
||||
<button
|
||||
className="btn small"
|
||||
disabled={busy || !quota.warn || !overview.mail.configured || quota.plan.freedBytes <= 0}
|
||||
disabled={busy || !overview.mail.configured || quota.plan.freedBytes <= 0}
|
||||
title={
|
||||
!overview.mail.configured
|
||||
? 'Configure Gmail notifications first'
|
||||
: !quota.warn
|
||||
? 'Only accounts at the warning threshold can be pruned'
|
||||
: quota.plan.freedBytes <= 0
|
||||
? 'Nothing is old enough to reach the cleanup target'
|
||||
: `Oldest content to remove: ${planSummary(quota)}`
|
||||
}
|
||||
onClick={() => scheduleQuotaPrune(quota)}
|
||||
|
||||
Reference in New Issue
Block a user