Changeset - 79567af5523e
[Not reviewed]
default
0 4 0
Mads Kiilerich (mads) - 5 years ago 2021-01-10 22:10:34
mads@kiilerich.com
Grafted from: 32003970f8c5
hooks: drop UI display of internal hooks - these hooks are just an implementation detail
4 files changed with 1 insertions and 24 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/settings.py
Show inline comments
 
@@ -364,7 +364,6 @@ class SettingsController(base.BaseContro
 
        defaults = db.Setting.get_app_settings()
 
        defaults.update(self._get_hg_ui_settings())
 

	
 
        c.hooks = db.Ui.get_builtin_hooks()
 
        c.custom_hooks = db.Ui.get_custom_hooks()
 

	
 
        return htmlfill.render(
kallithea/model/db.py
Show inline comments
 
@@ -354,14 +354,6 @@ class Ui(meta.Base, BaseDbModel):
 
        return setting
 

	
 
    @classmethod
 
    def get_builtin_hooks(cls):
 
        q = cls.query()
 
        q = q.filter(cls.ui_key.in_([cls.HOOK_UPDATE, cls.HOOK_REPO_SIZE]))
 
        q = q.filter(cls.ui_section == 'hooks')
 
        q = q.order_by(cls.ui_section, cls.ui_key)
 
        return q.all()
 

	
 
    @classmethod
 
    def get_custom_hooks(cls):
 
        q = cls.query()
 
        q = q.filter(~cls.ui_key.in_([cls.HOOK_UPDATE, cls.HOOK_REPO_SIZE]))
kallithea/templates/admin/settings/settings_hooks.html
Show inline comments
 
<div class="form">
 
      <div class="form-group">
 
      <h4>${_('Built-in Mercurial Hooks (Read-Only)')}</h4>
 
      % for hook in c.hooks:
 
        <% input_id = hook.ui_key.replace('.', '_') %>
 
            <label class="control-label" for="${input_id}" title="${hook.ui_key}">${hook.ui_key}</label>
 
            <div>
 
              ${h.text(hook.ui_key,hook.ui_value,id=input_id,size=60,readonly="readonly",class_='form-control')}
 
            </div>
 
      % endfor
 
      </div>
 
</div>
 

	
 
% if c.visual.allow_custom_hooks_settings:
 
${h.form(url('admin_settings_hooks'), method='post')}
 
<div class="form">
kallithea/tests/functional/test_admin_settings.py
Show inline comments
 
@@ -33,6 +33,7 @@ class TestAdminSettingsController(base.T
 
    def test_index_hooks(self):
 
        self.log_user()
 
        response = self.app.get(base.url('admin_settings_hooks'))
 
        response.mustcontain(no='.kallithea_')
 

	
 
    def test_create_custom_hook(self):
 
        self.log_user()
 
@@ -96,8 +97,6 @@ class TestAdminSettingsController(base.T
 
                                            _session_csrf_secret_token=self.session_csrf_secret_token()))
 

	
 
        self.checkSessionFlash(response, 'reserved for internal use')
 
        response = response.follow()
 
        response.mustcontain('changegroup.kallithea_update')
 

	
 
    def test_index_search(self):
 
        self.log_user()
0 comments (0 inline, 0 general)