From 2b3b3aa5a73449502d5eea3fcb221e36c2cc6dd0 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Thu, 8 Oct 2020 22:28:51 +0200 Subject: [PATCH] observers: hide it for CE edition. - This hide is simple, but real logic is in the validate function which would only work if EE edition is installed. --- rhodecode/apps/repository/utils.py | 2 +- rhodecode/config/middleware.py | 1 + rhodecode/lib/base.py | 1 + rhodecode/public/css/main.less | 3 ++- rhodecode/templates/pullrequests/pullrequest.mako | 9 +++++++-- rhodecode/templates/pullrequests/pullrequest_show.mako | 2 ++ 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rhodecode/apps/repository/utils.py b/rhodecode/apps/repository/utils.py index bc323366..b2209a88 100644 --- a/rhodecode/apps/repository/utils.py +++ b/rhodecode/apps/repository/utils.py @@ -107,5 +107,5 @@ def validate_default_reviewers(review_members, reviewer_rules): return reviewers -def validate_observers(observer_members): +def validate_observers(observer_members, reviewer_rules): return {} diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py index 844780a1..c0678393 100644 --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -412,6 +412,7 @@ def sanitize_settings_and_apply_defaults(global_config, settings): """ settings.setdefault('rhodecode.edition', 'Community Edition') + settings.setdefault('rhodecode.edition_id', 'CE') if 'mako.default_filters' not in settings: # set custom default filters if we don't have it defined diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py index dd40aff6..684038bf 100644 --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -293,6 +293,7 @@ def attach_context_attributes(context, request, user_id=None, is_api=None): context.rc_config = rc_config context.rhodecode_version = rhodecode.__version__ context.rhodecode_edition = config.get('rhodecode.edition') + context.rhodecode_edition_id = config.get('rhodecode.edition_id') # unique secret + version does not leak the version but keep consistency context.rhodecode_version_hash = calculate_version_hash(config) diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less index 621ed404..77b6c00a 100644 --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -495,7 +495,8 @@ ul.auth_plugins { padding-top: 10px; } -#add_reviewer_input { +#add_reviewer_input, +#add_observer_input { padding-top: 10px } diff --git a/rhodecode/templates/pullrequests/pullrequest.mako b/rhodecode/templates/pullrequests/pullrequest.mako index 8bc42988..6a5a93e3 100644 --- a/rhodecode/templates/pullrequests/pullrequest.mako +++ b/rhodecode/templates/pullrequests/pullrequest.mako @@ -177,7 +177,7 @@

${_('loading...')}

- + % if c.rhodecode_edition_id == 'EE':
## members goes here, filled via JS based on initial selection ! @@ -193,7 +193,12 @@
- + % else: +

${_('This feature is available in RhodeCode EE edition only. Contact {sales_email} to obtain a trial license.').format(sales_email='sales@rhodecode.com')|n}

+

+ Pull request observers allows adding users who don't need to leave mandatory votes, but need to be aware about certain changes. +

+ % endif diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako index c67ef6a2..1d22823b 100644 --- a/rhodecode/templates/pullrequests/pullrequest_show.mako +++ b/rhodecode/templates/pullrequests/pullrequest_show.mako @@ -624,6 +624,7 @@ ## OBSERVERS + % if c.rhodecode_edition_id == 'EE': + % endif ## TODOs