Feature flag modmail muting

This commit is contained in:
MelissaCole
2015-08-20 13:45:24 -07:00
parent a9e8f4bec0
commit ea21528b1f
5 changed files with 27 additions and 7 deletions

View File

@@ -339,6 +339,7 @@ newsletter_list_id =
############################################ QUOTAS
# quota for various types of relations creatable in subreddits
sr_banned_quota = 10000
sr_muted_quota = 10000
sr_moderator_invite_quota = 10000
sr_contributor_quota = 10000
sr_wikibanned_quota = 10000
@@ -874,3 +875,4 @@ feature_give_hsts_grants = off
feature_multireddit_customizations = off
# Test if `https_testing_img_test` is loaded with an acceptable HTTPS cert according to users' browsers
feature_test_https_certs = off
feature_modmail_muting = off

View File

@@ -855,6 +855,9 @@ class ApiController(RedditController):
Complement to [POST_friend](#POST_api_friend)
"""
if type == 'muted' and not feature.is_enabled('modmail_muting'):
return abort(403, "This feature is not yet enabled")
self.check_api_friend_oauth_scope(type)
victim = iuser or nuser
@@ -997,6 +1000,9 @@ class ApiController(RedditController):
Complement to [POST_unfriend](#POST_api_unfriend)
"""
if type == 'muted' and not feature.is_enabled('modmail_muting'):
return abort(403, "This feature is not yet enabled")
self.check_api_friend_oauth_scope(type)
if type in self._sr_friend_types:
@@ -1766,6 +1772,9 @@ class ApiController(RedditController):
if not subreddit:
abort(403, 'Not modmail')
if not feature.is_enabled('modmail_muting', subreddit=subreddit.name):
return abort(403, "This feature is not yet enabled")
user = message.author_slow
if not c.user_is_admin:
if not subreddit.is_moderator_with_perms(c.user, 'access', 'mail'):
@@ -1800,6 +1809,9 @@ class ApiController(RedditController):
if not subreddit:
abort(403, 'Not modmail')
if not feature.is_enabled('modmail_muting', subreddit=subreddit.name):
return abort(403, "This feature is not yet enabled")
user = message.author_slow
if not c.user_is_admin:
if not subreddit.is_moderator_with_perms(c.user, 'access', 'mail'):

View File

@@ -1750,6 +1750,8 @@ class UserListListingController(ListingController):
elif where == 'muted':
if not has_mod_access:
abort(403)
if not feature.is_enabled('modmail_muting'):
abort(403)
self.listing_cls = MutedListing
elif where == 'wikibanned':

View File

@@ -494,6 +494,9 @@ class Reddit(Templated):
if is_single_subreddit:
if is_moderator_with_perms('access'):
buttons.append(NamedButton("banned", css_class="reddit-ban"))
if (is_moderator_with_perms('access', 'mail') and
feature.is_enabled("modmail_muting")):
buttons.append(NamedButton("muted", css_class="reddit-mute"))
if is_moderator_with_perms('flair'):
buttons.append(NamedButton("flair", css_class="reddit-flair"))

View File

@@ -241,14 +241,15 @@ class MessageButtons(PrintableButtons):
if thing.sr_id:
sr = thing.subreddit_slow
if (sr.is_muted(first_message.author_slow) or
(first_message.to_id and
sr.is_muted(first_message.recipient_slow))):
is_muted = True
if feature.is_enabled('modmail_muting', subreddit=sr.name):
if (sr.is_muted(first_message.author_slow) or
(first_message.to_id and
sr.is_muted(first_message.recipient_slow))):
is_muted = True
if (not sr.is_moderator(thing.author_slow) and
sr.is_moderator_with_perms(c.user, 'access', 'mail')):
can_mute = True
if (not sr.is_moderator(thing.author_slow) and
sr.is_moderator_with_perms(c.user, 'access', 'mail')):
can_mute = True
can_reply = (c.user_is_loggedin and
getattr(thing, "repliable", True) and