Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello, do you have any plans for porting Comment Notify to Drupal 8?
Comment | File | Size | Author |
---|---|---|---|
#31 | comment_notify-d8-2221061-31.interdiff.txt | 5.34 KB | Arla |
#31 | comment_notify-d8-2221061-31.patch | 74.6 KB | Arla |
| |||
#27 | comment_notify-d8-2221061-26.interdiff.txt | 23.65 KB | Arla |
#26 | comment_notify-d8-2221061-26.patch | 73.93 KB | Arla |
| |||
#21 | comment_notify-d8-2221061-8.patch | 73.28 KB | Arla |
|
Comments
Comment #1
snap_xComment #2
miro_dietikerIs there any activity on a 8.x port currently?
Comment #3
ArlaI will look into this, working on https://github.com/md-systems/comment_notify until it reaches a more or less stable state. Then I would love to see it pushed to drupal.org as well.
Comment #4
ArlaChanging the issue to keep it understandable even when the issue is presented out of module context.
Comment #5
gregglesJust want to say I'm paying attention to this and hope folks will test Arla's code.
Thanks everyone for your interest and work on this issue.
Comment #6
ArlaThe port is now functional and the test is passing for me. Tests and reviews are much welcome: https://github.com/md-systems/comment_notify
I had the idea to turn both the per-comment and per-user settings into real fields. That seems to be the D8 way. I started on a branch, see https://github.com/md-systems/comment_notify/compare/subscription-field for the general idea. Not completely sure if it's a good idea though.
Comment #7
gregglesThanks for all your work!
I suggest making the port just a straight port and then things like turning settings into fields would be a followup.
Do you want to post a patch?
Comment #8
ArlaHere we go
Comment #10
gregglesIs that a false positive warning from the testbot or really something to fix?
Comment #11
ArlaThat's the short array syntax [] which is not supported in PHP 5.3, which is what the testbot runs. Drupal 8 requires PHP 5.4 (or was it 5.5) so that is kind of a fake problem. I think you as a maintainer can edit those parameters somewhere in the project settings. Maybe you have to first create an 8.x-1.x branch, I'm not sure...
Comment #12
miro_dietikerYeah that doesn't work. With an issue version 7.x-1.x it is testing against Drupal 7.
First a maintainer needs to create a D8 branch, a release node, then the version shows up... and a patch can be tested against Drupal 8.
(Possibly additionally the automated test settings need adjustment as arild pointed out.)
Comment #14
gregglesI configured the project to use the new drupalci-style system to do php 5.5 and php 5.4 tests on the 7.x branch. So, we should get a fail on 5.4 and a pass on 5.5.
Comment #15
gregglesIt might require uploading the patch fresh to get the new drupalci to pick it up?
Comment #17
miro_dietiker:-) That doesn't work yet. This issue is still assigned to 7.x branch that means it checks out Drupal core 7.x.
You really need to create an 8.x branch, assign this issue to it and then upload the patch (or retest it if it still applies).
Comment #18
gregglesOK, ok ok
Comment #19
gregglesAnd let's see if doing this is enough :)
Comment #21
ArlaSame patch again
Comment #23
miro_dietikerWohoooo, and the bot starts to spread some love!
Comment #24
BerdirNice start.
Lots of feedback below, we will need to priorize what should be part of a first port and what should be done later. But there are some non-trivial problems to solve sooner or later, e.g. due to the comment-as-field approach that allows to have comments on anything, not just nodes.
Why is this not using the default function below, it's the same code?
a) Another example of hardcoded assumption on node/nid. This could result in mismatches for comments on e.g. users and having users and nodes with the same ID. We probably need a bigger issue to scan for all occurences of node/nid and make it more generic.
b) Querying storage tables in 8.x is problematic.. it's actually possible that the storage changes, e.g. because sites force storage to non-translatable.. that might be more likely than something like a MongoDB storage.
However, it's currently not possible to do anything else, we can't do an entity query on something that's not a field.
seems like this should be easy to convert to an entity query. not sure about the others here.
;)
don't drop this, use module_set_weight().
The comment here is lost in the new function, but I'm, not sure it's really true. Aggregation works better in 8.x.
If we keep this, then this will need cacheability metadata or the second library will be missing/still there if those conditions change.
use $user.
Mismatch between being generic but the settings below then assume that it is a node.
As a quickfix, we could support only comments on nodes, I'm nut sure how we want to make it configurable for all.. possibly based on the name of the field or so (full config entity id, e.g. node.article.comment).
Could also store this as third party settings on comment fields.
those things usually just add a submit handler that does stuff directly instead of doing it indirectly through CRUD hooks. Could have possible drawbacks, like no longer working through the API like before and something else can't re-act on it anymore like before in that hook.
Just a note: Assuming this can only be set through the UI then keeping this as a form-only validation should be OK.
Long term goal: Get rid of API functions in manually included inc files, make it a service.
I think you can catch this more easily through the base form id user_form now (see EntityForm::getBaseFormId())
Another "fun" problem to think about for the comment on non-node problem space.
Possibly getting all fields with type comment and check create access for their host.
Same here. See how contact_form_user_form_alter does this now.
good question ;)
this will go away if we make it a field I guess so not urgent. but if it stays, we should make it a storage load hook so that we don't need to execute those queries when loading cached comments (same for the user hook if we keep that)
$node->getEntityTypeId() definitely doesn't make sense :) so that fall back has no test coverage. Might also be easier to understand if we'd explicitly check for an empty array instead of this trick, the result would be the same
Drop that t(). That's wrong in 7.x too (user provided strings like variables should be translated using i18n_variable, not t())
the sanitize option no longer exists. Use PlainTextOutput::renderFromHtml() instead.
looks generated from module upgrader, should be cleaned up. coding standard, naming, camel case, ...
this would save all kinds of things like form_id into the config object. It's annoying but you should set() them explicitly.
Having a test that saves the confirm form would show that this then violates the schema.
this isn't a config form.
Comment #25
miro_dietikerSome notes from a quick review... :-)
The left join is confusing me since i would expect to have the users table and references to it cable.
Anyway you return $cids here... Is comment_notify here really just contain one line per comment? Otherwise this creates multiple results per comment...
A base pointing to itself? :-)
Use the $user var. ;-)
Check the log messages. There is some explicit remaining one... ;-)
Comment #26
Arla#24:
To keep it simple, I merged the two libraries and added them in-place in the build array. I'm not familiar enough with the aggregation topic to determine if this has a non-trivial effect on performance.
Let's create followups to
Phew.
#25:
1: Yes, there’s one entry per comment. It states 1) whether that comment author should be notified of followups, and 2) whether earlier watchers have been notified of the comment.
2: Yeah, that’s actually how it works.
Comment #27
ArlaSorry, forgot the interdiff.
Btw, as @Berdir made me aware, the test will not pass because the dependencies in .info.yml are read from the current code, not from the patch. Since we haven't committed the .info.yml yet, there are no dependencies to include. Bah.
Comment #28
BerdirMostly agreed on the follow-ups, but
support all entity types as commentable, not only nodes
is problematic as it can result in weird bugs with ID overlaps and so on. If we don't fully implement it in a first step then we should probably add some stop-gaps to opt out of anything that's not a node, with a common @todo, so they're easy to find (preferably pointing to an already existing issue).That said, before we start/decide that: I imagine quite a bit of complexity of that will go away if we do
move the "node_types" setting to third_party_settings on bundles
first. That will make quite a big part of the code base generic for all entities. So we should definitely work on that first, be it before or after the first commit/merge.I guess @greggles should make the decision on what of that should be follow-ups and what part of the initial commit or merge. I'd actually recommend to do the second. the patches are useful for reviewing, but it is probably nicer to merge in the separate, smaller commits, assuming they're more or less cleaned up (can also be done in an interactive rebase to improve commit messages and so on before the merge).
Comment #30
BerdirMaybe we should keep the notification part itself in the hook not sure. I guess we want to trigger notifications if comments are triggered through services/API. So this should be split up.
Comment #31
ArlaYeah. Moved that the mailalert part back to the update hook. Then discovered the insert hook and moved non-mailalert logic into the form submit hook. Since the submit hook is where we actually have the notify/notify_type values, that hook is about saving those values. Then the update/insert/publish hooks only has a conditional mailalert invocation.
Comment #33
ArlaWe could commit the info.yml file to begin with, to have the patches tested correctly :)
Comment #35
gregglesOK, committed for now to get the info.yml fix and so that followups can be more discrete. In the commit message I gave a mention to https://www.drupal.org/u/pjonckiere who had a pull request.
In terms of what should be in this issue vs. followups, I think it would be nice to have test coverage sooner than later, but I defer to the people actually doing the work.
Comment #36
BerdirOk. Given that you committed the full patch, I would say that we open follow-ups for #26 and then work on those tasks separately, see also #28 in which order I'd suggest to do that. @Arla, can you open those follow-ups and then close this?
Comment #37
ArlaOkay, I created followups.
Comment #38
gregglesAwesome, thanks Arla and thanks to MD Systems!
Comment #40
gregglesJust wanted to point out that #2684617: Comment Notify seems to block Create New User on Drupal 8 is an important followup item and #2684153: Invalid tokens as an item that has a workaround but is probably easy to fix in code.