Perhaps _privatemsg_send should give more feedback than always returning TRUE.

currently we use _privatemsg_send() inside conditional statements to make sure message was sent successfuly, however it always returns true rendering those checks somewhat useless.

In the future we should make _privatemsg_send perform various checks to make sure message was sent successfully and what not. maybe conditional statements around db_query... right now i am not sure, just brainstorming :)

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new4.78 KB

And I already thought this would stay open forever ;)

Attached patch returns $message which is passed through in the key message in privatemsg_new_thread() and privatemsg_reply().

Also fixes/improves some related apidocs and fixes a bug (success is not correctly set to FALSE if $form is TRUE).

frankcarey’s picture

Ah, another just-in-time patch :) Will test shortly

naheemsays’s picture

Status: Needs review » Reviewed & tested by the community

Just tested and this works.

frankcarey’s picture

oh, yeah... forgot... tested and works :) Patch required for my migrate => private message module.

litwol’s picture

Status: Reviewed & tested by the community » Needs review

After recent commits this failed to apply.

berdir’s picture

StatusFileSize
new4.43 KB

Re-roll.

naheemsays’s picture

Status: Needs review » Reviewed & tested by the community

Ready to go in.

frankcarey’s picture

when this goes in , I have a migrate integration module that will import privatemsg. Hopefully a release soon so folks can use it.

http://drupal.org/project/migrate_extras

litwol’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new5.74 KB

Notice the change in pm_send and _privatemsg_send.

most API that return status as TRUE actually return status of message validation BEFORE actually writing messages to DB. this patch makes _privatemsg_send return FALSE if db error occured. Now the rest of the API need to be updated to reflect this change and use actual send status of success or failure.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new6.38 KB

Updated privatemsg_new_thread() and privatemsg_reply() and fixed a type (A an.. ) in the error message. Tests still pass, surprisingly ;)

Your turn! ;)

litwol’s picture

Status: Needs review » Fixed

Committed patch from #9 along with some comments to better explain the new behavior of the API.

Status: Fixed » Closed (fixed)

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