From 9dc83b3b96ad00053a6737bfe647e39f9e6c2da3 Mon Sep 17 00:00:00 2001 From: Martin Lees <drov0@users.noreply.github.com> Date: Sun, 3 Apr 2022 23:23:55 -0400 Subject: [PATCH] Allows setting the muted role even if you're not subscribed --- hive/db/sql_scripts/community_helpers.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hive/db/sql_scripts/community_helpers.sql b/hive/db/sql_scripts/community_helpers.sql index dbed417db..4fd981363 100644 --- a/hive/db/sql_scripts/community_helpers.sql +++ b/hive/db/sql_scripts/community_helpers.sql @@ -9,10 +9,9 @@ declare __role_id SMALLINT; BEGIN SELECT id INTO __subscription_id FROM hive_subscriptions WHERE account_id = _account_id AND community_id = _community_id; - - if _role_id IS NOT NULL THEN + -- We allow setting the MUTED role even if you're not subscribed + if _role_id IS NOT NULL AND _role_id < 0 THEN SELECT role_id INTO __role_id FROM hive_roles WHERE account_id = _account_id AND community_id = _community_id; - --raise '%aa', __subscription_id; -- We don't allow setting a higher role than the current one if you aren't subscribed IF __subscription_id IS NULL AND ((__role_id IS NOT NULL AND __role_id < _role_id ) OR __role_id IS NULL) THEN return false; @@ -37,4 +36,4 @@ BEGIN RETURN TRUE; END; -$$; \ No newline at end of file +$$; -- GitLab