# HG changeset patch # User Mads Kiilerich # Date 2021-01-10 01:28:48 # Node ID e40717c471a028cba5bf4a1a6d273fb4887f689e # Parent 79567af5523e48086352b2cbc1ca13544bb91e54 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.) diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -356,8 +356,9 @@ class Ui(meta.Base, BaseDbModel): @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()