Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- The rows are gone for good: chat pushes straight from the conversation.
CREATE INDEX IF NOT EXISTS notifications_message_id_idx
ON public.notifications ((data->>'messageId'))
WHERE data->>'messageId' IS NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DELETE FROM public.notifications
WHERE type IN ('ChatMessage', 'MatchChatMessage');

DELETE FROM public.notification_preferences
WHERE channel = 'in_app'
AND key IN ('ChatMessage', 'MatchChatMessage');

DROP INDEX IF EXISTS public.notifications_message_id_idx;
23 changes: 0 additions & 23 deletions hasura/triggers/player_blocks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,6 @@ BEGIN
WHERE dc.room_id = LEAST(_a, _b)::text || ':' || GREATEST(_a, _b)::text
AND dc.steam_id = _a;

-- Chat hides what the blocked player said from the blocker, so their bell
-- previews go the way NotificationsService.retractChatMessage takes them:
-- blanked as well, since a recipient can restore their own deleted rows,
-- and a push still waiting in its bundling window skips a deleted row.
-- A moderator still sees group rooms whole (ChatService.blockExemptRoles),
-- so only their DM rows go.
UPDATE public.notifications n
SET deleted_at = COALESCE(n.deleted_at, now()),
message = ''
WHERE n.steam_id = _a
AND n.type IN ('ChatMessage', 'MatchChatMessage')
AND n.data->>'senderSteamId' = _b::text
AND (n.deleted_at IS NULL OR n.message <> '')
AND (
n.entity_id LIKE 'direct:%'
OR NOT EXISTS (
SELECT 1
FROM public.players p
WHERE p.steam_id = _a
AND public.is_role_below('moderator', p.role::text)
)
);

RETURN NULL;
END;
$$;
Expand Down
Loading
Loading