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.
Problem/Motivation
https://www.drupal.org/project/globallink/issues/3344157 and inspect console. There is a JS error Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'mergeActivity')
Proposed resolution
The current code is
const afterComment = comments.get(commentTimes.find(e => e < createdAt.getTime()));
if (afterComment.mergeActivity === undefined) {
But we could better check if an object has a property (see https://stackoverflow.com/questions/11040472/how-to-check-if-object-prop...).
Remaining tasks
MR
Issue fork drupalorg-3432638
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
fjgarlin CreditAttribution: fjgarlin as a volunteer and at Drupal Association commentedCode needs review. This page is using that code https://fjgarlin-drupal.dev.devdrupal.org/project/config_notify/issues/3..., but as it's an edge case I'm not sure we're testing that particular edge case. In any case, the change seemed really straightforward.
Comment #4
apadernoOn the dev site, Toggle MR Activity works as expected, and it even shows the number of comments that would be shown/hidden.
I checked https://fjgarlin-drupal.dev.devdrupal.org/project/config_notify/issues/3... as anonymous user, if that makes any difference.
Comment #7
fjgarlin CreditAttribution: fjgarlin as a volunteer and at Drupal Association commentedI did not anticipate this.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'hasOwnProperty')
So it seems like sometimes
afterComment
is completely null or undefined.Maybe we can do something like this (though I don't get why it's fully empty or undefined in this case):
Comment #10
fjgarlin CreditAttribution: fjgarlin as a volunteer and at Drupal Association commentedCreated new MR https://git.drupalcode.org/project/drupalorg/-/merge_requests/235 with #7.
Comment #11
drummWe’re assuming all MR activity happens after the first issue comment. GitLab seems to have pulled in “@mloayza commented on commit 151669b7 2 years ago” on https://git.drupalcode.org/project/globallink/-/merge_requests/3.
So we either discard that MR note, or set
afterComment
to the earliest element ofcomments
Comment #13
drummThe second fix is deployed & confirmed working now.