From bf41dfd2ed201615a34b0b260bce8ff24a1d55ca Mon Sep 17 00:00:00 2001 From: Mustaaq Ahmed Khan <150926835+khanmustaaq@users.noreply.github.com> Date: Tue, 11 Nov 2025 08:03:37 -0500 Subject: [PATCH] Disable discourse_comments_count method The discourse_comments_count method has been disabled to always return 0 without interacting with pkg_dict or making HTTP calls. --- ckanext/discourse/plugin.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/ckanext/discourse/plugin.py b/ckanext/discourse/plugin.py index cf8d97a..9935733 100644 --- a/ckanext/discourse/plugin.py +++ b/ckanext/discourse/plugin.py @@ -142,21 +142,8 @@ def discourse_comments(self, pkg_dict=None): return '' def discourse_comments_count(self, pkg_dict=None): - """Get comment count from Discourse.""" - try: - pkg = pkg_dict or toolkit.g.pkg_dict - topic_id = pkg.get('topic_id') - - if not (self.settings and topic_id): - return 0 - - api = DiscourseApi(self.settings) - count = api.get_topic_comment_count(topic_id) - return count - - except Exception as e: - log.error(f"Error getting comment count: {str(e)}") - return 0 + """Disabled: always return 0; never touches g.pkg_dict or calls HTTP.""" + return 0 def discourse_is_configured(self): """Check if Discourse is properly configured."""