Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"last uid" is not respected when range and list of user IDs is provided. #10

Open
wants to merge 1 commit into
base: 7.x-1.x
Choose a base branch
from

Conversation

capuleto
Copy link

Message subscribe does not use "last uid" at all when the list of user IDs is provided and range is enabled in subscribe options.
https://www.drupal.org/node/2256899

message_subscribe_send_message('node', $this->node, $message, array(), $subscribe_options);

// Run cron.
$this->cronRun();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. can we avoid running cron, and invoke the needed function ourself?

@capuleto
Copy link
Author

I have queued to patches to test bot since Travis build fails.
Only tests: https://qa.drupal.org/pifr/test/1186683
Patch and tests: https://qa.drupal.org/pifr/test/1186688

@amitaibu I'll update the request if you have any suggestions on how to check for sent emails without using the capture functionality built-in Simpletest.

@amitaibu
Copy link
Member

amitaibu commented Dec 3, 2015

Tests seem to be failing because Travis needs to be updated - drush should be installed via composer now.

@ordavidil can you please review.

@ordavidil
Copy link

@capuleto
Sorry for the delay, just updating you that I'm already on it...

$uids = $subscribe_options['range'] ? array_slice($subscribe_options['uids'], 0, $subscribe_options['range'], TRUE) : $subscribe_options['uids'];
// If 'last uid' is provided, we need to start from next 'uid' key in array.
if (!empty($subscribe_options['last uid'])) {
$index = array_search($subscribe_options['last uid'], array_keys($subscribe_options['uids'])) + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@capuleto
This is OK assuming last uid is in the uids array,
but if not,
then $index = 1 as default.

@amitaibu
Can we live with that assumption ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we live with that assumption ?

You'll have to check, and I don't remember :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@capuleto
Can you please add a check that determine if the last uid is in the uids array?
If it's not then just use same fallback (set $index = 0;) and add this scenario to the docs.

If you can add a test for that scenario as well it can be awesome :)

@amitaibu
This should cover it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants