diff --git a/server/migrations/2020-06-30-135809_remove_mat_views/up.sql b/server/migrations/2020-06-30-135809_remove_mat_views/up.sql index f4174b305..a0614b210 100644 --- a/server/migrations/2020-06-30-135809_remove_mat_views/up.sql +++ b/server/migrations/2020-06-30-135809_remove_mat_views/up.sql @@ -552,9 +552,6 @@ begin 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 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 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; diff --git a/server/src/api/user.rs b/server/src/api/user.rs index a4e47e41c..9b72a9199 100644 --- a/server/src/api/user.rs +++ b/server/src/api/user.rs @@ -678,7 +678,8 @@ impl Perform for Oper { } 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() { return Err(APIError::err("couldnt_update_user").into()); }