changeset 8842:e40717c471a0

hooks: be more consistent in only using active Ui entries There is no UI to control or display the ui_active value for custom hooks, but *if* they are inactive, they will be ignored in make_ui, and it will be misleading and confusing to show them in the list of active custom hooks. There *should* never be any inactive hooks entries, but let's be consistent in handling the case *if* it should happen. (It happened for me while hacking around.)
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 10 Jan 2021 01:28:48 +0100
parents 79567af5523e
children 8c7bbe5bd032
files kallithea/model/db.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/db.py	Sun Jan 10 22:10:34 2021 +0100
+++ b/kallithea/model/db.py	Sun Jan 10 01:28:48 2021 +0100
@@ -356,8 +356,9 @@
     @classmethod
     def get_custom_hooks(cls):
         q = cls.query()
+        q = q.filter(cls.ui_section == 'hooks')
         q = q.filter(~cls.ui_key.in_([cls.HOOK_UPDATE, cls.HOOK_REPO_SIZE]))
-        q = q.filter(cls.ui_section == 'hooks')
+        q = q.filter(cls.ui_active)
         q = q.order_by(cls.ui_section, cls.ui_key)
         return q.all()