(#4684) Remove Disqus from the Platform#5133
(#4684) Remove Disqus from the Platform#5133dev-rana-publicis wants to merge 1 commit intodevelopfrom
Conversation
242e421 to
1c71eb6
Compare
|
Update: this PR has the needed UX & QA checks. Holding on tech review and merge as we want to merge PR # 5132 prior to this PR. Cc: @andyvanavery31 |
1c71eb6 to
fbbdeb4
Compare
|
@dev-rana-publicis From copilot when asked did any files get missed... I'll start by reviewing the PR changes and understanding what's being removed, then search the codebase for any references that might have been missed.Let me start by reviewing the PR to understand what blocks, fields, and modules are being removed, then search the codebase for any remaining references.Now I have a clear picture of what the PR removes. Let me search the codebase for any remaining references to PR Review: Missing Files for Disqus RemovalI've thoroughly searched the codebase for all references to the Disqus-related items being removed in this PR. Here's what I found: ✅ What the PR Already Covers (Good!)The PR correctly removes/updates:
|
| Priority | File | Issue |
|---|---|---|
| Medium | config/install/field.field.node.cgov_blog_series.field_blog_series_shortname.yml |
description still references "Disqus URL" — should update to reflect current usage |
| Low | themes/custom/cgov/src/styles/_blogs.scss |
.blog-comment-policy style is now dead code |
| Low | themes/custom/cgov/src/styles/_hacks.scss |
.blog-comment-policy style + Disqus comments are dead code |
| Low | themes/custom/ncids_trans/front-end/src/legacy/styles/_blogs.scss |
.blog-comment-policy style is now dead code |
| Low | Both _blogs.scss files |
@TODO comment referencing Disqus/IntenseDebate replacement |
The field_blog_series_shortname description update is probably the most important since it would be misleading to editors. The SCSS cleanups are lower priority but would be good housekeeping.
Note: Search results are limited, so there may be additional references. You can verify with a full code search for "disqus" in the repo and for "blog-comment-policy".
There was a problem hiding this comment.
Pull request overview
Removes all remaining Disqus integration from the CGov Digital Platform’s blog feature set, including the Disqus block plugin, theme templates, and related configuration/content references, and adds an update hook to roll the config changes into existing sites.
Changes:
- Delete the
cgov_disqusblock plugin and Disqus Twig templates from both blog themes. - Remove the “allow comments” field/config references used to control Disqus on blog series/posts.
- Add a
cgov_blogupdate hook to import updated feature configs and remove/purge the legacy comments field.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| phpstan.neon | Removes PHPStan exclusion entry for the deleted Disqus block plugin. |
| docroot/profiles/custom/cgov_site/themes/custom/ncids_trans/templates/content/blog/block--cgov-disqus.html.twig | Deletes Disqus block theme template (ncids_trans). |
| docroot/profiles/custom/cgov_site/themes/custom/cgov/cgov_common/templates/content/blog/block--cgov-disqus.html.twig | Deletes Disqus block theme template (cgov_common). |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_yaml_content/content/06400_blog-post-cc.content.yml | Removes field_allow_comments values from YAML content. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_yaml_content/content/06200_blog-series.content.yml | Removes field_allow_comments values from YAML content. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_yaml_content/content/06100_blog-series-rssfeed.content.yml | Removes field_allow_comments values from YAML content. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_core/src/Plugin/Block/DisqusComments.php | Deletes the Disqus block plugin implementation (cgov_disqus). |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/field.storage.node.field_allow_comments.yml | Removes the field storage config for field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/field.field.node.cgov_blog_series.field_allow_comments.yml | Removes the blog series field instance config for field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.thumbnail_card_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.panoramic_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_promo_block_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_list_item_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_flag_card_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_feature_card_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.lb_primary_content.yml | Removes the field component for field_allow_comments from the view display. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.full.yml | Removes the field component for field_allow_comments from the view display. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.feature_card_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.embedded_feature_card_no_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.embedded_feature_card.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.default.yml | Removes the field component for field_allow_comments from the default view display. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.borderless_card_image.yml | Removes display dependencies/hidden settings tied to field_allow_comments. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_post.full.yml | Removes the layout-builder Disqus block placement from blog post full view mode. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_form_display.node.cgov_blog_series.default.yml | Removes field_allow_comments from the blog series edit form display config. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/cgov_blog.install | Adds update hook to import feature config and delete/purge the legacy comments field. |
| docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/cgov_blog.info.yml | Updates Drupal core version requirement. |
Comments suppressed due to low confidence (2)
docroot/profiles/custom/cgov_site/themes/custom/cgov/cgov_common/templates/content/blog/block--cgov-disqus.html.twig:1
- This template previously set
s.src = "{{ content }}"inside a<script>block without escapingcontentfor JavaScript context, which allowed injection of arbitrary JS ifcontentcontained double quotes or other control characters. Becausecontentultimately came from thefield_blog_series_shortnametext field on the blog series node, an editor could craft a value like";alert(1);//to break out of the string and execute script in visitors' browsers. Removing this template and the associated Disqus block eliminates this injection point; if similar functionality is reintroduced, ensure untrusted values are escaped for JS context (e.g., via a Twig JS-escape filter) rather than concatenated directly into script code.
docroot/profiles/custom/cgov_site/themes/custom/ncids_trans/templates/content/blog/block--cgov-disqus.html.twig:1 - This template previously set
s.src = "{{ content }}"inside a<script>block without escapingcontentfor JavaScript context, which allowed injection of arbitrary JS ifcontentcontained double quotes or other control characters. Becausecontentultimately came from thefield_blog_series_shortnametext field on the blog series node, an editor could craft a value like";alert(1);//to break out of the string and execute script in visitors' browsers. Removing this template and the associated Disqus block eliminates this injection point; if similar functionality is reintroduced, ensure untrusted values are escaped for JS context (e.g., via a Twig JS-escape filter) rather than concatenated directly into script code.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| \Drupal::service('field.purge')->purgeBatch(50); | ||
| } | ||
| else { | ||
| field_purge_batch(50); |
There was a problem hiding this comment.
cgov_blog_update_10001() purges only a single batch (50) of field data. On sites with more than 50 items queued for deletion, field_allow_comments data/tables may remain partially purged after the update runs. Consider looping until the purge call returns 0 (or explicitly documenting that follow-up cron/drush runs are required) to ensure the field is fully removed.
| \Drupal::service('field.purge')->purgeBatch(50); | |
| } | |
| else { | |
| field_purge_batch(50); | |
| // Continue purging in batches of 50 until there is nothing left to purge. | |
| do { | |
| $purged_count = \Drupal::service('field.purge')->purgeBatch(50); | |
| } while ($purged_count > 0); | |
| } | |
| else { | |
| // Fallback for environments without the field.purge service. | |
| if (function_exists('field_purge_batch')) { | |
| do { | |
| $purged_count = field_purge_batch(50); | |
| } while ($purged_count > 0); | |
| } |
There was a problem hiding this comment.
This comment was last week so I'm assuming it's junk, but just wanted to double check :)
There was a problem hiding this comment.
This change makes sense as currently, the update hook is purging 50 items at once, and Copilots revision continues to loop until all data is purged. Curious however as this update hook is very similar to what we have for #5132 but copilot didn't complain about that update hook. Testing these changes locally now - should be able to push soon.
fbbdeb4 to
b172c8b
Compare
|
passes testing on test-acsf |
b172c8b to
2cb604f
Compare
f334092 to
0c455d6
Compare
bryanpizzillo
left a comment
There was a problem hiding this comment.
I have some questions regarding the cache context items below... That code seems to have been added last year as part of fixing #4568.
0c455d6 to
38da2e8
Compare
|
GitHub was acting up, and this is a part of the code base and has been merged, despite this appearing as not being merged. |


Closes #4684
ODE 1078