Fixing accidental addadmin bug from asonix async merge.

This commit is contained in:
Dessalines 2020-07-04 23:38:45 -04:00
parent 2eaafae892
commit 5a88a6ecdc
2 changed files with 2 additions and 4 deletions

View file

@ -552,9 +552,6 @@ begin
IF (TG_OP = 'DELETE') THEN IF (TG_OP = 'DELETE') THEN
update comment_aggregates_fast set banned_from_community = false where creator_id = OLD.user_id and community_id = OLD.community_id; update comment_aggregates_fast set banned_from_community = false where creator_id = OLD.user_id and community_id = OLD.community_id;
update post_aggregates_fast set banned_from_community = false where creator_id = OLD.user_id and community_id = OLD.community_id; update post_aggregates_fast set banned_from_community = false where creator_id = OLD.user_id and community_id = OLD.community_id;
ELSIF (TG_OP = 'UPDATE') THEN
-- delete from comment_aggregates_fast where id = NEW.comment_id;
-- insert into comment_aggregates_fast select * from comment_aggregates_view where id = NEW.comment_id;
ELSIF (TG_OP = 'INSERT') THEN ELSIF (TG_OP = 'INSERT') THEN
update comment_aggregates_fast set banned_from_community = true where creator_id = NEW.user_id and community_id = NEW.community_id; update comment_aggregates_fast set banned_from_community = true where creator_id = NEW.user_id and community_id = NEW.community_id;
update post_aggregates_fast set banned_from_community = true where creator_id = NEW.user_id and community_id = NEW.community_id; update post_aggregates_fast set banned_from_community = true where creator_id = NEW.user_id and community_id = NEW.community_id;

View file

@ -678,7 +678,8 @@ impl Perform for Oper<AddAdmin> {
} }
let added = data.added; let added = data.added;
let add_admin = move |conn: &'_ _| User_::add_admin(conn, user_id, added); let added_user_id = data.user_id;
let add_admin = move |conn: &'_ _| User_::add_admin(conn, added_user_id, added);
if blocking(pool, add_admin).await?.is_err() { if blocking(pool, add_admin).await?.is_err() {
return Err(APIError::err("couldnt_update_user").into()); return Err(APIError::err("couldnt_update_user").into());
} }