Try more restrictive detault notification settings

This commit is contained in:
Ian Philips 2022-09-16 07:43:27 -06:00
parent 456aed467c
commit 6a5873f8d4

View File

@ -60,14 +60,6 @@ export const getDefaultNotificationPreferences = (
privateUser?: PrivateUser, privateUser?: PrivateUser,
noEmails?: boolean noEmails?: boolean
) => { ) => {
const {
unsubscribedFromCommentEmails,
unsubscribedFromAnswerEmails,
unsubscribedFromResolutionEmails,
unsubscribedFromWeeklyTrendingEmails,
unsubscribedFromGenericEmails,
} = privateUser || {}
const constructPref = (browserIf: boolean, emailIf: boolean) => { const constructPref = (browserIf: boolean, emailIf: boolean) => {
const browser = browserIf ? 'browser' : undefined const browser = browserIf ? 'browser' : undefined
const email = noEmails ? undefined : emailIf ? 'email' : undefined const email = noEmails ? undefined : emailIf ? 'email' : undefined
@ -75,84 +67,48 @@ export const getDefaultNotificationPreferences = (
} }
return { return {
// Watched Markets // Watched Markets
all_comments_on_watched_markets: constructPref( all_comments_on_watched_markets: constructPref(true, false),
true, all_answers_on_watched_markets: constructPref(true, false),
!unsubscribedFromCommentEmails
),
all_answers_on_watched_markets: constructPref(
true,
!unsubscribedFromAnswerEmails
),
// Comments // Comments
tips_on_your_comments: constructPref(true, !unsubscribedFromCommentEmails), tips_on_your_comments: constructPref(true, true),
comments_by_followed_users_on_watched_markets: constructPref(true, false), comments_by_followed_users_on_watched_markets: constructPref(true, true),
all_replies_to_my_comments_on_watched_markets: constructPref( all_replies_to_my_comments_on_watched_markets: constructPref(true, true),
true, all_replies_to_my_answers_on_watched_markets: constructPref(true, true),
!unsubscribedFromCommentEmails
),
all_replies_to_my_answers_on_watched_markets: constructPref(
true,
!unsubscribedFromCommentEmails
),
all_comments_on_contracts_with_shares_in_on_watched_markets: constructPref( all_comments_on_contracts_with_shares_in_on_watched_markets: constructPref(
true, true,
!unsubscribedFromCommentEmails false
), ),
// Answers // Answers
answers_by_followed_users_on_watched_markets: constructPref( answers_by_followed_users_on_watched_markets: constructPref(true, true),
true, answers_by_market_creator_on_watched_markets: constructPref(true, true),
!unsubscribedFromAnswerEmails
),
answers_by_market_creator_on_watched_markets: constructPref(
true,
!unsubscribedFromAnswerEmails
),
all_answers_on_contracts_with_shares_in_on_watched_markets: constructPref( all_answers_on_contracts_with_shares_in_on_watched_markets: constructPref(
true, true,
!unsubscribedFromAnswerEmails true
), ),
// On users' markets // On users' markets
your_contract_closed: constructPref( your_contract_closed: constructPref(true, true), // High priority
true, all_comments_on_my_markets: constructPref(true, true),
!unsubscribedFromResolutionEmails all_answers_on_my_markets: constructPref(true, true),
), // High priority
all_comments_on_my_markets: constructPref(
true,
!unsubscribedFromCommentEmails
),
all_answers_on_my_markets: constructPref(
true,
!unsubscribedFromAnswerEmails
),
subsidized_your_market: constructPref(true, true), subsidized_your_market: constructPref(true, true),
// Market updates // Market updates
resolutions_on_watched_markets: constructPref( resolutions_on_watched_markets: constructPref(true, false),
true,
!unsubscribedFromResolutionEmails
),
market_updates_on_watched_markets: constructPref(true, false), market_updates_on_watched_markets: constructPref(true, false),
market_updates_on_watched_markets_with_shares_in: constructPref( market_updates_on_watched_markets_with_shares_in: constructPref(
true, true,
false false
), ),
resolutions_on_watched_markets_with_shares_in: constructPref( resolutions_on_watched_markets_with_shares_in: constructPref(true, true),
true,
!unsubscribedFromResolutionEmails
),
//Balance Changes //Balance Changes
loan_income: constructPref(true, false), loan_income: constructPref(true, false),
betting_streaks: constructPref(true, false), betting_streaks: constructPref(true, false),
referral_bonuses: constructPref(true, true), referral_bonuses: constructPref(true, true),
unique_bettors_on_your_contract: constructPref(true, false), unique_bettors_on_your_contract: constructPref(true, false),
tipped_comments_on_watched_markets: constructPref( tipped_comments_on_watched_markets: constructPref(true, true),
true,
!unsubscribedFromCommentEmails
),
tips_on_your_markets: constructPref(true, true), tips_on_your_markets: constructPref(true, true),
limit_order_fills: constructPref(true, false), limit_order_fills: constructPref(true, false),
@ -160,17 +116,11 @@ export const getDefaultNotificationPreferences = (
tagged_user: constructPref(true, true), tagged_user: constructPref(true, true),
on_new_follow: constructPref(true, true), on_new_follow: constructPref(true, true),
contract_from_followed_user: constructPref(true, true), contract_from_followed_user: constructPref(true, true),
trending_markets: constructPref( trending_markets: constructPref(false, true),
false,
!unsubscribedFromWeeklyTrendingEmails
),
profit_loss_updates: constructPref(false, true), profit_loss_updates: constructPref(false, true),
probability_updates_on_watched_markets: constructPref(true, false), probability_updates_on_watched_markets: constructPref(true, false),
thank_you_for_purchases: constructPref( thank_you_for_purchases: constructPref(false, false),
false, onboarding_flow: constructPref(false, false),
!unsubscribedFromGenericEmails
),
onboarding_flow: constructPref(false, !unsubscribedFromGenericEmails),
} as notification_preferences } as notification_preferences
} }