Conversation last message/activity: Use IS/IS NOT to better handle NULL

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal 2021-11-18 16:30:29 -08:00 committed by GitHub
parent 4c30e272f3
commit 96909cdbf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -2450,11 +2450,11 @@ function getLastConversationActivity({
json_extract(json, '$.expirationTimerUpdate.fromSync') != 1
) AND NOT
(
type = 'group-v2-change' AND
json_extract(json, '$.groupV2Change.from') != $ourUuid AND
json_extract(json, '$.groupV2Change.details.length') = 1 AND
json_extract(json, '$.groupV2Change.details[0].type') = 'member-remove' AND
json_extract(json, '$.groupV2Change.details[0].uuid') != $ourUuid
type IS 'group-v2-change' AND
json_extract(json, '$.groupV2Change.from') IS NOT $ourUuid AND
json_extract(json, '$.groupV2Change.details.length') IS 1 AND
json_extract(json, '$.groupV2Change.details[0].type') IS 'member-remove' AND
json_extract(json, '$.groupV2Change.details[0].uuid') IS NOT $ourUuid
)
ORDER BY received_at DESC, sent_at DESC
LIMIT 1;
@ -2501,11 +2501,11 @@ function getLastConversationPreview({
)
) AND NOT
(
type = 'group-v2-change' AND
json_extract(json, '$.groupV2Change.from') != $ourUuid AND
json_extract(json, '$.groupV2Change.details.length') = 1 AND
json_extract(json, '$.groupV2Change.details[0].type') = 'member-remove' AND
json_extract(json, '$.groupV2Change.details[0].uuid') != $ourUuid
type IS 'group-v2-change' AND
json_extract(json, '$.groupV2Change.from') IS NOT $ourUuid AND
json_extract(json, '$.groupV2Change.details.length') IS 1 AND
json_extract(json, '$.groupV2Change.details[0].type') IS 'member-remove' AND
json_extract(json, '$.groupV2Change.details[0].uuid') IS NOT $ourUuid
)
ORDER BY received_at DESC, sent_at DESC
LIMIT 1;