mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Expando: Add media prefs to events
This commit is contained in:
@@ -180,6 +180,17 @@ def js_config(extra_config=None):
|
||||
cur_listing = ""
|
||||
listing_over_18 = False
|
||||
pref_no_profanity = not logged or c.user.pref_no_profanity
|
||||
pref_media_preview = c.user.pref_media_preview
|
||||
|
||||
if not feature.is_enabled("autoexpand_media_previews"):
|
||||
expando_preference = None
|
||||
elif pref_media_preview == "subreddit":
|
||||
expando_preference = "subreddit_default"
|
||||
elif pref_media_preview == "on":
|
||||
expando_preference = "auto_expand"
|
||||
else:
|
||||
expando_preference = "do_not_expand"
|
||||
|
||||
nsfw_media_acknowledged = logged and c.user.nsfw_media_acknowledged
|
||||
|
||||
if isinstance(c.site, Subreddit) and not c.default_sr:
|
||||
@@ -258,6 +269,7 @@ def js_config(extra_config=None):
|
||||
"static_root": static(''),
|
||||
"over_18": bool(c.over18),
|
||||
"listing_over_18": listing_over_18,
|
||||
"expando_preference": expando_preference,
|
||||
"pref_no_profanity": pref_no_profanity,
|
||||
"nsfw_media_acknowledged": nsfw_media_acknowledged,
|
||||
"new_window": logged and bool(c.user.pref_newwindow),
|
||||
|
||||
@@ -70,6 +70,14 @@ r.analytics = {
|
||||
r.analytics.screenviewEvent();
|
||||
}
|
||||
|
||||
if (r.config.expando_preference) {
|
||||
r.analytics.contextData.expando_preference = r.config.expando_preference;
|
||||
}
|
||||
|
||||
if (r.config.pref_no_profanity) {
|
||||
r.analytics.contextData.media_preference_hide_nsfw = r.config.pref_no_profanity
|
||||
}
|
||||
|
||||
r.analytics.firePageTrackingPixel(r.analytics.stripAnalyticsParams);
|
||||
|
||||
},
|
||||
@@ -448,6 +456,8 @@ r.analytics = {
|
||||
'listing_name',
|
||||
'referrer_domain',
|
||||
'referrer_url',
|
||||
'expando_preference',
|
||||
'media_preference_hide_nsfw',
|
||||
]);
|
||||
|
||||
if ('linkIsNSFW' in targetData) {
|
||||
|
||||
Reference in New Issue
Block a user