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

This commit is contained in:
Chris Van 2012-09-27 17:36:03 -07:00
Родитель 309d310de7
Коммит 9cb244acd5
11 изменённых файлов: 48 добавлений и 24 удалений

Просмотреть файл

@ -1362,7 +1362,7 @@ class TestReview(ReviewBase):
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 @@ class TestReview(ReviewBase):
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()

Просмотреть файл

@ -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 _review(request, addon):
# 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 @@ VALIDATOR_TIMEOUT = -1
# 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 @@ DEBUG_PROPAGATE_EXCEPTIONS = DEBUG
#
# 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.

Просмотреть файл

@ -1546,3 +1546,7 @@ REGION_STORES = False
# 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 @@ class TestReviewApp(AppReviewerTest, AccessMixin, AMOPaths):
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'))

Просмотреть файл

@ -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'))

Просмотреть файл

@ -80,6 +80,8 @@ VIDEO_LIBRARIES = ['lib.video.dummy']
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.

Просмотреть файл

@ -30,13 +30,13 @@ DATABASES = {
'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 @@ REDIS_BACKENDS = {
'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 @@ METLOG_CONF = {
'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_HOST = private_mkt.BROKER_HOST
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 @@ MIDDLEWARE_CLASSES += (
'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