summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-04-06 14:28:14 +0200
committerYorhel <git@yorhel.nl>2021-04-06 14:28:16 +0200
commit06fd82629e32d3ea53738e96121855d74d7b23d3 (patch)
tree153027749a0ec55692b5f45bf898b77b3ea5870b
parent6ac072ee63ec243a3c388b13f8c1dcf403906322 (diff)
Fix trying to notify deleted user
Fixes https://vndb.org/t950.915
-rw-r--r--sql/func.sql3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/func.sql b/sql/func.sql
index d8cceb47..e6cb6ccb 100644
--- a/sql/func.sql
+++ b/sql/func.sql
@@ -504,8 +504,9 @@ CREATE OR REPLACE FUNCTION notify(iid vndbid, num integer, uid vndbid) RETURNS T
FROM (
-- pm
- SELECT 'pm'::notification_ntype, tb.iid
+ SELECT 'pm'::notification_ntype, u.id
FROM threads_boards tb
+ JOIN users u ON u.id = tb.iid
WHERE vndbid_type($1) = 't' AND tb.tid = $1 AND tb.type = 'u'
AND NOT EXISTS(SELECT 1 FROM notification_subs ns WHERE ns.iid = $1 AND ns.uid = tb.iid AND ns.subnum = false)