Map admins: owners invite friends to co-manage maps
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 6m2s

Owners can invite players by name from the map workshop; invitees accept
from their dashboard and then manage the map (details, locations,
submission, refresh, contributions, appeals) through owner-delegated
checks. Adds the map_admins table, invite/admin API endpoints, dashboard
invite box, workshop admin management, and Russian translations.
This commit is contained in:
2026-10-31 17:28:05 +05:00
parent 0d62f08e77
commit 05854818a0
11 changed files with 603 additions and 18 deletions

24
tests/sql/map-admins.sql Normal file
View File

@@ -0,0 +1,24 @@
begin;
do $$
declare owner uuid:=gen_random_uuid(); friend uuid:=gen_random_uuid(); map uuid; manifest jsonb; invite uuid;
begin
insert into auth.users(id) values(owner),(friend);
insert into public.profiles(id) values(owner),(friend) on conflict(id) do nothing;
manifest:='{"format":"minegeo-dataset/v1","source":"plugin","mediaFormat":"webp","name":"Admin fixture","description":"","serverName":"Admin fixture server","bounds":{"minX":0,"minZ":0,"maxX":64,"maxZ":64},"viewpoints":[{"id":"p0","x":0,"y":70,"z":0},{"id":"p1","x":1,"y":70,"z":1},{"id":"p2","x":2,"y":70,"z":2},{"id":"p3","x":3,"y":70,"z":3},{"id":"p4","x":4,"y":70,"z":4}],"assets":[]}';
map:=public.create_upload(owner,manifest);
insert into public.map_admins(dataset_id,user_id,invited_by) values(map,friend,owner) returning id into invite;
if (select state from public.map_admins where id=invite)<>'pending' then raise exception 'Invite did not start pending'; end if;
begin insert into public.map_admins(dataset_id,user_id,invited_by) values(map,friend,owner); raise exception 'Duplicate invite allowed';
exception when unique_violation then null; end;
begin insert into public.map_admins(dataset_id,user_id,invited_by) values(map,owner,owner); raise exception 'Self invite allowed';
exception when check_violation then null; end;
begin update public.map_admins set responded_at=now() where id=invite; raise exception 'Pending invite stamped';
exception when check_violation then null; end;
update public.map_admins set state='accepted',responded_at=now() where id=invite;
if not exists(select 1 from public.map_admins where id=invite and state='accepted' and responded_at is not null) then raise exception 'Accept failed'; end if;
begin update public.map_admins set responded_at=null where id=invite; raise exception 'Response timestamp dropped';
exception when check_violation then null; end;
delete from public.datasets where id=map;
if exists(select 1 from public.map_admins where id=invite) then raise exception 'Invite survived map deletion'; end if;
end; $$;
rollback;