Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Correct assignment of users' flairtext and flair_css_class so that subreddit settings are taken into account. #1606

Closed
wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented May 24, 2016

Reddit continues to serve the author_flair_text field in the JSON even when the user flair has been disabled by the mods for a particular subreddit. This is because the flair_text is currently populated only based on users' preferences, ignoring the subreddit setting. A new argument has been introduced to fix this; a default value is specified such that the behaviour remains the same as was before this change, should the argument not be used.

Originally reported here.

@13steinj
Copy link
Contributor

Just as a "code grammar" gripe -- never pass on a keyword argument if that argument is redundant from the outside. Meaning; flair_enabled_by_sr is a kwarg determined by an external factor.

Also, that's for automoderator. Which may be good to check flairs regardless of mod disabling, since mods could use this then as a hidden way to keep track of problem posters if flairs are disabled (mods can still manually set invisible userflairs).

The way it should have been done is in r2/lib/jsontemplates.py, where if attr=='author_flair_text' (/css), add a if not thing.subreddit.flair_enabled check.

@bsimpson63
Copy link
Contributor

Sorry, but this repository is no longer accepting pull requests.

@bsimpson63 bsimpson63 closed this Oct 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants