feat(push): scope read clears to the enrolled cohort (#2935)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-24 15:15:45 +02:00
1 parent a90991612c
commit 963ffc5550
3 files changed
+35 -1

No files matched your search

@@ -81,6 +81,9 @@ env_gateway_base_config() ->
<<"push_clear_notifications_enabled">> => env_bool(
"FLUXER_GATEWAY_PUSH_CLEAR_NOTIFICATIONS_ENABLED", true
),
<<"push_enrolled_clear_notifications_enabled">> => env_bool(
"FLUXER_GATEWAY_PUSH_ENROLLED_CLEAR_NOTIFICATIONS_ENABLED", true
),
<<"push_endpoint_guard_enabled">> => env_bool(
"FLUXER_GATEWAY_PUSH_ENDPOINT_GUARD_ENABLED", true
),
@@ -259,6 +262,9 @@ build_push_config(Service, Public) ->
push_clear_notifications_enabled => get_bool(
Service, <<"push_clear_notifications_enabled">>, true
),
push_enrolled_clear_notifications_enabled => get_bool(
Service, <<"push_enrolled_clear_notifications_enabled">>, true
),
push_endpoint_guard_enabled => get_bool(
Service, <<"push_endpoint_guard_enabled">>, true
),
+10 -1
View File
@@ -246,7 +246,9 @@ clear_channel_notifications(UserId, ChannelId, MessageId) ->
-spec clear_for_enrolment(boolean(), integer(), integer(), integer()) -> ok.
clear_for_enrolment(true, UserId, ChannelId, MessageId) ->
ok = push_outbox:truncate_read(UserId, ChannelId, MessageId),
cast_clear_if_enabled(clear_notifications_enabled(), UserId, ChannelId, MessageId);
cast_clear_if_enabled(
enrolled_clear_notifications_enabled(), UserId, ChannelId, MessageId
);
clear_for_enrolment(false, UserId, ChannelId, MessageId) ->
cast_clear_if_enabled(clear_notifications_enabled(), UserId, ChannelId, MessageId).
@@ -256,6 +258,13 @@ cast_clear_if_enabled(true, UserId, ChannelId, MessageId) ->
cast_clear_if_enabled(false, _UserId, _ChannelId, _MessageId) ->
ok.
-spec enrolled_clear_notifications_enabled() -> boolean().
enrolled_clear_notifications_enabled() ->
case persistent_term:get(push_enrolled_clear_notifications_enabled, undefined) of
OperatorChoice when is_boolean(OperatorChoice) -> OperatorChoice;
_ -> env_boolean(push_enrolled_clear_notifications_enabled, true)
end.
-spec clear_notifications_enabled() -> boolean().
clear_notifications_enabled() ->
case persistent_term:get(push_clear_notifications_enabled, undefined) of