From bca2729e262ca8917d3e179d44aea95af372965b Mon Sep 17 00:00:00 2001 From: mutantsan Date: Tue, 28 Mar 2023 12:55:44 +0300 Subject: [PATCH] fix: enable activity fix only if plugin is enabled v2 --- ckanext/core_fix/helpers.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ckanext/core_fix/helpers.py b/ckanext/core_fix/helpers.py index 930289e..6697c4d 100644 --- a/ckanext/core_fix/helpers.py +++ b/ckanext/core_fix/helpers.py @@ -13,23 +13,21 @@ log = logging.getLogger(__name__) -if p.plugin_loaded('activity'): - @tk.chained_helper - def dashboard_activity_stream( - next_func: Callable[..., Any], *args, **kw: Any # type: ignore - ) -> list[dict[str, Any]]: - """ - Insert `offset` positional argument - If kw isn't empty, we are started to pass kw args properly +def dashboard_activity_stream( + next_func: Callable[..., Any], *args, **kw: Any # type: ignore +) -> list[dict[str, Any]]: + """ + Insert `offset` positional argument + If kw isn't empty, we are started to pass kw args properly - https://github.com/ckan/ckan/pull/7482 - """ + https://github.com/ckan/ckan/pull/7482 + """ - if not kw: - args: list[Any] = list(args) - args.insert(3, 0) + if not kw: + args: list[Any] = list(args) + args.insert(3, 0) - return next_func(*args, **kw) + return next_func(*args, **kw) def get_fixes_with_css() -> list[str]: @@ -43,7 +41,9 @@ def get_helpers(): "cf_get_fixes_with_css": get_fixes_with_css, } - if p.plugin_loaded('activity'): + if p.plugin_loaded("activity"): + tk.chained_helper(dashboard_activity_stream) + helpers["dashboard_activity_stream"] = dashboard_activity_stream if utils.is_fix_disabled(conf.Fixes.dashboard_activity):