Drupal Pushover is a module that adds support for sending notifications to Pushover App(iOS, Android) with rules. It gives you the possibility to get push notifications when someting happens on your Drupal site.
Now there are two possible rules you can use: "Send to all users of role" and "Send to specific users".
Drupal version: 7.x
Project page: http://drupal.org/sandbox/andeersg/1902816
Git: git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/andeersg/1902816.git drupal_pushover
PAReview bonus:
http://drupal.org/node/1117996#comment-7025536
http://drupal.org/node/1827350#comment-7028408
http://drupal.org/node/1890794#comment-7025428
Comments
Comment #1
andeersg commentedDone reviews.
Comment #2
alexmoreno commentedVery interesting module, very well coded... just add a couple of comments between your lines and I think it could be "ready to rock and roll" :-).
Nothing more to add, you delete the variables in your install, using files to separate different functionalities, a readme explains how to install and use it, ... very good job anderersg :-)
No errors in the automatic review: http://ventral.org/pareview/httpgitdrupalorgsandboxandeersg1902816git
Anyone confirm it, but i think it could be ready to mark as tested by the community :-)
Comment #3
andeersg commentedThank you for your feedback.
Have updated the module with more documentation on the function sending the notification, fixed some wrong text, made the API-key field required.
Comment #4
PDNagilum commentedThe module seem to do exactly what it says. The rules integration works like a charm.
Some minor things:
Code review:
Comment #5
andeersg commentedFixed most of your comments now.
I have waited with the watchdog notifications because i have to come up with something clever to prevent infinite loops.
Comment #6
tsphethean commentedJust a few relatively minor things:
In
_pushover_send_notification()it would be good to return TRUE or FALSE depending on successful return code. Functions which call _pushover_send_notification() can then choose to display messages based on success or failure.In pushover.rules.inc,
$titleis passed into_pushover_send_notification()but is undefined (lines 159 and 183) so you will get PHP warnings from this. Looks like you could set this to NULL or to the value of$subjectpushover_send_to_user_rule() the comment for this function says "send notification to single user" but from the code it looks like this will send to multiple users.
Otherwise looking good, looks a pretty cool module.
Comment #7
tsphethean commentedDuplicate. Deleting.
Comment #8
tsphethean commentedComment #9
andeersg commentedFixed everything you said :)
Smart idea to return TRUE or FALSE.
Comment #10
tsphethean commentedLooks good - the only further thing I'd do on the return TRUE/FALSE is that you currently check:
if ($response->code !== '200' || $return_data->status !== 1) {but don't do anything if that doesnt match. What I'd maybe do (which reflects what PDNagilum said in #4 is:
(check my code actually works of course as I've not tested it!). This way you're then telling your calling applications/rules that something unexpected happened, and you're logging it for investigation later.
Comment #11
andeersg commentedBut if i understand the API correctly Response code 200 and Status 1 means everything went ok.
If i think correctly that means the example you provided only should return TRUE on the ELSE. Since if that block of code is not triggered it means the drupal_http_request was ok.
If both the http request and the mail fails, Drupal Mail notifies watchdog by default.
Correct me on this if i'm wrong :)
Comment #12
tsphethean commentedNo, you're right - I think I mixed up = and != in the logic :-)
In that case, the return FALSE should come just after the drupal_mail, and return TRUE in the else.
I still think it would be worth logging the failure specifically in your own watchdog category (just before you return FALSE) so you can easily filter from all the other drupal_mail log entries, but its not a show stopper.
Comment #13
andeersg commentedThere, found an example for checking if mail was successful here: http://api.drupal.org/api/drupal/modules%21system%21system.module/functi...
So now i use watchdog when mail is sent, and return TRUE or FALSE.
Edit: Thank you for very fast feedback :)
Comment #14
tsphethean commentedNice one, that looks good. Based on code review and that other fixes from other posters look like they've been incorporated I'm going to mark as RTBC and see if anyone disagrees...
Good stuff, and a good module for Drupal.
Comment #15
andeersg commentedThank you very much :)
I really think i have removed all bugs and stuff :)
Comment #16
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
But that are not critical application blockers, so ...
Thanks for your contribution, andeersg!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.