eee0885811
- Remove recursive directory size calculations (single Seafile API call per list) - Remove 'Used in this location' usage display - Fix move using v2 per-type endpoints instead of broken batch endpoint - Send entry type from frontend for correct move routing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
907 B
PL/PgSQL
31 lines
907 B
PL/PgSQL
-- Allow client revision returns to clear stale assignments while keeping
|
|
-- assignment fields protected for normal client updates.
|
|
create or replace function public.guard_task_update()
|
|
returns trigger as $$
|
|
declare
|
|
caller_role text;
|
|
begin
|
|
select role into caller_role from public.profiles where id = auth.uid();
|
|
|
|
if caller_role = 'client' then
|
|
new.project_id := old.project_id;
|
|
new.invoiced := old.invoiced;
|
|
|
|
if not (
|
|
new.status = 'not_started'
|
|
and coalesce(new.current_version, 0) > coalesce(old.current_version, 0)
|
|
and new.assigned_to is null
|
|
and new.assigned_name is null
|
|
) then
|
|
new.assigned_to := old.assigned_to;
|
|
new.assigned_name := old.assigned_name;
|
|
end if;
|
|
elsif caller_role = 'external' then
|
|
new.project_id := old.project_id;
|
|
new.invoiced := old.invoiced;
|
|
end if;
|
|
|
|
return new;
|
|
end;
|
|
$$ language plpgsql security definer;
|