Permalink
Browse files

allow self-reviews for add-ons/apps on -dev

  • Loading branch information...
1 parent 309d310 commit 9cb244acd5fa524c64c48933c4cc32183f18fea8 @cvan cvan committed Sep 28, 2012
@@ -1362,7 +1362,7 @@ def test_not_anonymous(self):
self.assertRedirects(r,
'%s?to=%s' % (reverse('users.login'), self.url))
- @patch.object(settings, 'DEBUG', False)
+ @patch.object(settings, 'ALLOW_SELF_REVIEWS', False)
def test_not_author(self):
AddonUser.objects.create(addon=self.addon, user=self.editor)
eq_(self.client.head(self.url).status_code, 302)
@@ -1536,7 +1536,8 @@ def generate_deleted_versions(self):
if 'action' in version:
d = dict(action=version['action'], operating_systems='win',
- applications='something', comments=version['comments'],
+ applications='something',
+ comments=version['comments'],
addon_files=[v.files.all()[0].pk])
self.client.post(self.url, d)
v.delete()
View
@@ -432,8 +432,7 @@ def app_review(request, addon):
def _review(request, addon):
version = addon.latest_version
- if (not settings.DEBUG and
- addon.authors.filter(user=request.user).exists()):
+ if not settings.ALLOW_SELF_REVIEWS and addon.has_author(request.amo_user):
amo.messages.warning(request, _('Self-reviews are not allowed.'))
return redirect(reverse('editors.queue'))
@@ -517,11 +516,11 @@ def version(self):
# Grab review history for deleted versions of this add-on
comments = (CommentLog.objects
- .filter(activity_log__action__in=amo.LOG_REVIEW_QUEUE,
- activity_log__versionlog=None,
- activity_log__addonlog__addon=addon)
- .order_by('created')
- .select_related('activity_log'))
+ .filter(activity_log__action__in=amo.LOG_REVIEW_QUEUE,
+ activity_log__versionlog=None,
+ activity_log__addonlog__addon=addon)
+ .order_by('created')
+ .select_related('activity_log'))
comment_versions = defaultdict(PseudoVersion)
for c in comments:
@@ -78,3 +78,7 @@
# TASK_USER_ID = 1
WEBAPPS_RECEIPT_KEY = os.path.join(ROOT, 'mkt/webapps/tests/sample.key')
+
+# If you want to allow self-reviews for add-ons/apps, then enable this.
+# In production we do not want to allow this.
+ALLOW_SELF_REVIEWS = True
@@ -60,3 +60,8 @@
#
# from metlog.config import client_from_dict_config
# METLOG = client_from_dict_config(METLOG_CONF)
+
+
+# If you want to allow self-reviews for add-ons/apps, then enable this.
+# In production we do not want to allow this.
+ALLOW_SELF_REVIEWS = False
@@ -2,6 +2,14 @@ Settings Changelog
==================
+2012-09-27
+----------
+
+* Added ``ALLOW_SELF_REVIEWS`` which allows you to approve/reject your own
+ add-ons and apps. This is especially useful for testing on our staging
+ and -dev servers. In production this should always remain ``False``.
+
+
2012-09-25
----------
@@ -10,7 +18,7 @@ Settings Changelog
optional) so people can look to see what has happened in settings-land.
* Removed ``confusion`` (optional)
* Using 'Added' and 'Removed' and 'Changed' as the start of your lines gives a
- nice way to quickly read these.
+ nice way to quickly read these.
* Changed default ``way to find changes`` from ``ask in IRC`` to ``check the
changelog``
* We can debate the format, but this gives us a starting point.
View
@@ -1546,3 +1546,7 @@ def read_only_mode(env):
# The tuple is passed through to datetime.date, so please use a valid date
# tuple. If the value is None, then it will just not be used at all.
DEV_AGREEMENT_LAST_UPDATED = None
+
+# If you want to allow self-reviews for add-ons/apps, then enable this.
+# In production we do not want to allow this.
+ALLOW_SELF_REVIEWS = False
@@ -723,7 +723,7 @@ def test_escalated(self, in_escalation_queue):
content = pq(self.client.get(self.url).content)
assert content('#queue-escalation').length
- @mock.patch.object(settings, 'DEBUG', False)
+ @mock.patch.object(settings, 'ALLOW_SELF_REVIEWS', False)
def test_cannot_review_my_app(self):
AddonUser.objects.create(addon=self.app,
user=UserProfile.objects.get(username='editor'))
View
@@ -152,8 +152,7 @@ def context(**kw):
def _review(request, addon):
version = addon.latest_version
- if (not settings.DEBUG and
- addon.authors.filter(user=request.user).exists()):
+ if not settings.ALLOW_SELF_REVIEWS and addon.has_author(request.amo_user):
messages.warning(request, _('Self-reviews are not allowed.'))
return redirect(reverse('reviewers.home'))
View
@@ -80,6 +80,8 @@ def _polite_tmpdir():
INAPP_VERBOSE_ERRORS = False
INAPP_REQUIRE_HTTPS = True
+ALLOW_SELF_REVIEWS = True
+
# Make sure debug toolbar output is disabled so it doesn't interfere with any
# html tests.
View
@@ -30,13 +30,13 @@
'sa_pool_key': 'master',
},
'slave': {
- 'NAME': private.DATABASES_SLAVE_NAME,
+ 'NAME': private.DATABASES_SLAVE_NAME,
#'ENGINE': 'mysql_pool.base.db_pool',
'ENGINE': 'mysql_pool',
- 'HOST': private.DATABASES_SLAVE_HOST,
+ 'HOST': private.DATABASES_SLAVE_HOST,
'PORT': private.DATABASES_SLAVE_PORT,
'USER': private.DATABASES_SLAVE_USER,
- 'PASSWORD': private.DATABASES_SLAVE_PASSWORD,
+ 'PASSWORD': private.DATABASES_SLAVE_PASSWORD,
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
'sa_pool_key': 'slave',
},
@@ -115,12 +115,12 @@
'cache': private.REDIS_BACKENDS_CACHE,
'cache_slave': private.REDIS_BACKENDS_CACHE_SLAVE,
'master': private.REDIS_BACKENDS_MASTER,
- 'slave': private.REDIS_BACKENDS_SLAVE,
+ 'slave': private.REDIS_BACKENDS_SLAVE,
}
CACHE_MACHINE_USE_REDIS = True
-RECAPTCHA_PUBLIC_KEY = private.RECAPTCHA_PUBLIC_KEY
-RECAPTCHA_PRIVATE_KEY = private.RECAPTCHA_PRIVATE_KEY
+RECAPTCHA_PUBLIC_KEY = private.RECAPTCHA_PUBLIC_KEY
+RECAPTCHA_PRIVATE_KEY = private.RECAPTCHA_PRIVATE_KEY
RECAPTCHA_URL = ('https://www.google.com/recaptcha/api/challenge?k=%s' % RECAPTCHA_PUBLIC_KEY)
CSP_FRAME_SRC = ("'self'", "https://sandbox.paypal.com",)
@@ -211,9 +211,11 @@
'plugins': {'cef': ('metlog_cef.cef_plugin:config_plugin', {})},
'sender': {
'class': 'metlog.senders.UdpSender',
- 'host': private.METLOG_CONF_SENDER_HOST,
+ 'host': private.METLOG_CONF_SENDER_HOST,
'port': private.METLOG_CONF_SENDER_PORT,
},
}
USE_METLOG_FOR_CEF = True
+
+ALLOW_SELF_REVIEWS = True
@@ -56,7 +56,7 @@
BROKER_PORT = private_mkt.BROKER_PORT
BROKER_USER = private_mkt.BROKER_USER
BROKER_PASSWORD = private_mkt.BROKER_PASSWORD
-BROKER_VHOST = private_mkt.BROKER_VHOST
+BROKER_VHOST = private_mkt.BROKER_VHOST
CELERY_IGNORE_RESULT = True
CELERY_DISABLE_RATE_LIMITS = True
CELERYD_PREFETCH_MULTIPLIER = 1
@@ -117,15 +117,15 @@
'amo.middleware.LoginRequiredMiddleware',
)
-VALIDATOR_IAF_URLS = ['https://marketplace.mozilla.org',
- 'https://marketplace.allizom.org',
+VALIDATOR_IAF_URLS = ['https://marketplace.mozilla.org',
+ 'https://marketplace.allizom.org',
'https://marketplace-dev.allizom.org']
AMO_LANGUAGES = AMO_LANGUAGES + ('dbg',)
LANGUAGES = lazy(lazy_langs, dict)(AMO_LANGUAGES)
LANGUAGE_URL_MAP = dict([(i.lower(), i) for i in AMO_LANGUAGES])
-BLUEVIA_SECRET = private_mkt.BLUEVIA_SECRET
+BLUEVIA_SECRET = private_mkt.BLUEVIA_SECRET
#Bug 748403
SIGNING_SERVER = private_mkt.SIGNING_SERVER

0 comments on commit 9cb244a

Please sign in to comment.