Comments are going to be decoupled from node to field and AJAX framework has significant changes

This module should be ported to D8 ASAP because all underling subsystems are mostly stable

Related issue #731724: Convert comment settings into a field to make them work with CMI and non-node entities

Change notices
- Form API Ajax now handled by D8 Ajax API from #1843220-67: Convert form AJAX to new AJAX API

Poring roadmap:
1) Update to latest d7 dev
2) Convert Javascript to d8
3) Convert ajax_comments_comment_view_alter(adding classes to comment form links)
4) Implement ajax callbacks for reply/edit/delete
5) Convert Views integration
6) Port nodejs integration
7) Enable Comment Form caching

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

formatC'vt’s picture

Issue summary: View changes
Status: Active » Needs work

yep, i agree with you, we need a D8 version =)

muschpusch’s picture

At drupalcon i started working on the very basics (settings form, routing, etc.). Ajax comments is still completely broken but i will push what i have so far... :)

formatC'vt’s picture

This is good. About settings form... i think we need to remove "View mode", see this issue #2330537: Semantic error in active detection

muschpusch’s picture

I remember that i tried fixing this a while ago and failed. So yes if nobody else wants to give it a try let's remove this functionality?

formatC'vt’s picture

I don't know about D8, but in D7 there no way to get node view mode from hook_comment_view().
I agree with deletion and @andypost, he said about we no need so deeply config like "node type + view mode" =)

muschpusch’s picture

True! You wanna remove it? Go ahead :) but we should write it in the release notes of the next release!

andypost’s picture

Also there's new approach could be useful #1875974: Abstract 'component type' specific code out of EntityDisplay

PS: maybe it makes sense to make initial port at github to easily colaborate?

muschpusch’s picture

formatC'vt’s picture

Assigned: Unassigned » formatC'vt

Hi guys, repository on github has no commits on past 6 month.
We come back from github to drupal.org repository.

andypost’s picture

It's still easy to fork at github, then we can merge it to d.o

In a bunch of related issues the markup for comments would change so I will try to follow and review ongoing changes

andypost’s picture

And specifically for comment links

formatC'vt’s picture

Issue summary: View changes

ok, thanks @andypost
Added porting roadmap

  • formatC'vt authored 5f3880c on 8.x-1.x
    Issue #1947898 by formatC'vt: Port AJAX Comments to D8. Step 1. Update...
formatC'vt’s picture

Issue summary: View changes

two first steps are compleate

  • formatC'vt authored dc1a3bb on 8.x-1.x
    Issue #1947898 by formatC'vt: Port AJAX Comments to D8. Step 3. Adding...
formatC'vt’s picture

Issue summary: View changes

step 3 done.

andypost’s picture

FileSize
11.44 KB

I've created https://github.com/andypost/ajax_comments and start conversion, also added yours changes

Patch is an intermediate step, suppose to implement basic functionality first.

Comments can be attached to any entity so settings for allowed bundles should live on "third_party_settings" probably in CommentType config, OTOH more granular settings could be stored within comment field or maybe better in comment default formatter.

formatC'vt’s picture

oh, i'm already add controller too and add some changes, but yours more d8 style way, i will merge my changes with yours on this week (probably today :).

  • andypost authored c5398f3 on 8.x-1.x
    Issue #1947898 by andypost: Port AJAX Comments to D8. Implement basic...

  • formatC'vt authored c592f10 on 8.x-1.x
    Issue #1947898 by formatC'vt: Port AJAX Comments to D8. Merge with...
formatC'vt’s picture

Merged.
Step 4. WIP. AJAXed comment form links, added Content types options and etc.

danmuzyka’s picture

Status: Needs work » Needs review
FileSize
24.79 KB

I've been working on getting this module functioning with the current release of Drupal 8 core. So far, I've made updates to get the baseline ajax comment-submission functionality working, including some changes to make it work properly with core's use of the #lazy_builder callback for the comment form.

In the next few weeks I'll be working on separate patches for the ajax callbacks for edit and delete. Work on the reply ajax callback might come later on, I'm not sure, yet.

Note that there is one ajax bug in core's Editor module that affects this patch, for which I've filed this core bug and patch: https://www.drupal.org/node/2692453 .

Patch file attached. Please let me know if you have feedback or suggested changes.

Finally, would it be possible to create an 8.x-1.x version tag on this project, so that I can create new issues with the correct version tag, as needed?

formatC'vt’s picture

Assigned: formatC'vt » Unassigned

hi, thanks
we already have 8.x-1.x branch - https://www.drupal.org/node/348630/git-instructions/8.x-1.x

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks really awesome!
Just minor nits, suppose it's time to make 8.x-1.x-dev release!

+++ b/src/Tests/AjaxCommentsTest.php
@@ -0,0 +1,49 @@
+    $this->drupalPostAjaxForm(NULL, $edit, ['op' => t('Save')]);
+    $this->drupalGet('node/' . $this->node->id());
+    $this->assertText(Xss::filter($comment), 'Comment posted.');
+    $this->pass($comment);

suppose after posting comment you should not get page again
just make assertText()

jhedstrom’s picture

we already have 8.x-1.x branch

Right, but there's no way to file issues against it because there is no dev release :)

danmuzyka’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
25.25 KB
1.4 KB

Hi @andypost, thanks for that feedback. WebTestBase does not appear to be able to simulate changes to a page's DOM like a full browser would be able to do. I've updated the test, however, to check the content of the ajax response directly. I'll refactor the test to be a bit more elegant in a future patch, likely when I work on the controller for editing comments.

Let me know if this new patch works for you.

Thanks,
Dan

formatC'vt’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Needs review » Needs work

committed & released, thanks
If I am not mistaken - still needs work

jhedstrom’s picture

Status: Needs work » Fixed

The initial port seems to be working, and since there's already an 8.x branch, it probably makes sense to do further work in separate issues. Marking this as fixed. I've also updated the status of #2684537: [ajax_comments] AJAX Comments accordingly.

danmuzyka’s picture

I have two separate issues I've posted so far, and I'm working on a patch to get ajax comment delete functionality working, so I'll post an issue for that when I have the patch ready.

Existing issues for D8 port:
https://www.drupal.org/node/2702303
https://www.drupal.org/node/2697165

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.