Changeset - e40717c471a0
[Not reviewed]
default
0 1 0
Mads Kiilerich - 5 years ago 2021-01-10 01:28:48
mads@kiilerich.com
Grafted from: 55ca4ca42407
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.)
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/model/db.py
Show inline comments
 
@@ -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()
 

	
0 comments (0 inline, 0 general)