repo-settings: add hidden view to force re-install hooks.

Used mainly for admin tasks that require a support action, and allows
to force reinstall hooks without a remap&rescann option.
This commit is contained in:
Marcin Kuzminski 2018-04-03 13:33:16 +02:00
parent bdf5f0afb6
commit 173415824b
2 changed files with 20 additions and 2 deletions

View file

@ -331,6 +331,10 @@ def includeme(config):
name='edit_repo_advanced_fork',
pattern='/{repo_name:.*?[^/]}/settings/advanced/fork', repo_route=True)
config.add_route(
name='edit_repo_advanced_hooks',
pattern='/{repo_name:.*?[^/]}/settings/advanced/hooks', repo_route=True)
# Caches
config.add_route(
name='edit_repo_caches',

View file

@ -43,8 +43,6 @@ class RepoSettingsView(RepoAppView):
def load_default_context(self):
c = self._get_local_tmpl_context()
return c
@LoginRequired()
@ -231,3 +229,19 @@ class RepoSettingsView(RepoAppView):
raise HTTPFound(
h.route_path('edit_repo_advanced', repo_name=self.db_repo_name))
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.admin')
@view_config(
route_name='edit_repo_advanced_hooks', request_method='GET',
renderer='rhodecode:templates/admin/repos/repo_edit.mako')
def edit_advanced_install_hooks(self):
"""
Install Hooks for repository
"""
_ = self.request.translate
self.load_default_context()
self.rhodecode_vcs_repo.install_hooks(force=True)
h.flash(_('installed hooks repository'), category='success')
raise HTTPFound(
h.route_path('edit_repo_advanced', repo_name=self.db_repo_name))