Closed (won't fix)
Project:
Privatemsg
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2009 at 08:34 UTC
Updated:
26 Jul 2016 at 15:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
litwol commentedYour patch has wrong format. Have a look at this link as it describes proper patch format: http://drupal.org/patch/create
Comment #2
naheemsays commentedThe patch will also need more work - it will also need to evaluate if a thread_id has been set along with the reply function and then return TRUE or FALSE.
Comment #3
pluess commentedThanks for pointing me to the page. Please find the patch in the right format in the attachment.
Comment #4
pluess commentedHi nbz
Guess you mean privatemsg_reply(...). Well I can read the comment on the function, but I could not make the modul calling this function. What is it really used for?
But you're right, my code is just showing the reply form, but sending a reply does not work. I had to add another check in _privatemsg_validate_message(...) to get it working. Seams that I was happy to see the reply form and never really tested to send a reply. Shame on me!
Please find the improoved code patch against 6.x-1.x-dev attached.
Comment #5
pluess commentedAnd again, including the patch.
Comment #6
berdirThe -dev version has been updated, there is now a new permission after write privatemsg so you need to update your patch.
I'm not sure if "reply only" is a good name for a permission as it is quite generic. Not sure what to use instead.
Also, your check in validate_message() is too simple, it will also allow to send new messages through the api functions. So you need to check tha either a user is allowed to write private messages OR (he can reply and there is a $message['thread_id']).
PS: No need to change privatemsg_reply(), as all api functions call validate_message() and it can be handled in there.
Comment #7
pluess commentedThe patch is updated to the new -dev version.
validate_message() checks for the thread_id now.
With the new -dev version, preview doesn't really work with my patch. If I click the preview button, the message is displayed as preview but the message form disappears. I debugged the form generation in single step mode. As far as I can see the message body is always part of the form, but it's not shown. Any ideas about how to further investigate this?
Comment #8
berdirThe indentation is a bit off and it should have an ending ",", Drupal Coding Standard...
I assume that is a left-over of your debugging :)
Regarding your issue, first, make sure that the issue does not happen without your patch. also make sure to check the value of $form['privatemsg']['#access']. If you can't figure it out, clean up the above things and I will give it a try.
Comment #9
berdirSee #579148: Bugs in new/reply form, it is a bug in the current -dev version
Comment #10
pluess commentedTidy work is done.
Tidied up the code and tested it together with the patch from #579148: Bugs in new/reply form.
Everything looks god to me.
About the name of the permission. What about "reply to thread"?
Comment #11
berdirThere is a tab instead of spaces, so it looks wrong in the patch (and tabs aren't allowed anyway for exactly that reason).
Now you removed too much. This would block users with "write privatemsg" permission. You need to check for write privatemsg OR reply only.
Hm. "'#access' => privatemsg_user_access('write privatemsg') || privatemsg_user_access('reply only')" should work too here. However, you probably have to check if you are in reply mode ($thread_id is set) or not. So you need to update your if to check for empty($thread_id) and if true, only check for write else check for both with the above statement.
What about "reply to private messages" since that contains more or less the module name in it. I'm wondering if it is clear that write privatemsg allows to reply too. D7 will allow us to solve that by adding a description. maybe even go for "only reply to private messages"?
Also, please name your next patch whatever.diff or .patch, that makes it easier to review with http://drupal.org/project/dreditor
Comment #12
mikesir87 commentedI'm interested in this functionality. Has there been any updates recently? If not, I can try and pitch in where needed...
Comment #13
berdirYeah, a re-roll is needed here, see my comment above.
Some other things that just came to my mind:
- maybe we can make privatemsg_user_access() a bit more intelligent, so that checking for reply permission also checks for the write permission
- A simple test would be great (create user a with write permission, user b with reply, write message from user a to b, check that user b can reply but not write new messages)
Comment #14
mikesir87 commentedWell, do you recommend we work off one of the existing patches on here, or sorta start from scratch? If we should work off a patch, which do you feel is the closest to the correct functionality?
Comment #15
berdirYou can use the patch in #10 I think, atleast what's applying of that. A big chunk of it will not, since the privatemsg_view and privatemsg_new functions have been moved to privatemsg.pages.inc.
Comment #16
joostvdl commentedsubscribe
Comment #17
joostvdl commentedI Used the code from patch at #10 and placed it in the latest 6.x-2.x-dev release (20-4-2010).
I called the permissions : "reply only privatemsg"
See attached patches
Comment #19
berdirThanks for working on this...
- You should provide them as a single patch. This is easier if you use CVS but it requires more initial work/learning. Do you know http://drupal.org/patch?
- It seems that you diffed them in the wrong order, it removes the changes instead of adding them..
- Not really necessary but some tests would be awesome! (See also #13) I can help you with that, ping me in #drupal when I'm around or ask here if you have any questions.
Comment #20
joostvdl commentedThe new patch file as requested
I don't know anything about testing. So I'll try to contact you @ #drupal .... If you have some references about making the tests, please let me know.
Comment #21
joostvdl commentedNew correct patch based on CVS
Comment #22
berdirI'm not sure if that statement is correct, need to test it.
Apart from that, the patch looks good now, looking forward to your tests!
Hint: To actually test the above, you probably need create two separate test cases. One which uses the UI (that will probably never even trigger the above code) and a second with uses the api functions privatemsg_new_thread() and privatemsg_reply().
Powered by Dreditor.
Comment #24
berdirOk, the if is wrong then. You probably need something like this:
Comment #25
joostvdl commentedAnother try...
Comment #26
joostvdl commented#21: privatemsg-572374.patch queued for re-testing.
Comment #27
berdirJust wondering if you still plan to work on some tests?
Don't want to get this fall behind again... :)
Comment #28
joostvdl commentedFirst I have to satisfy my customer with a new website. After the site is live (2-3 weeks) I will look into the test.
Comment #29
berdirNo problem, no need to hurry.
Comment #30
artscoop commentedOne bump.
I am going to test the current patch. (in #25)
This permission would be neat.
Testing finished (quickly but it's sure) :
Well, it works. I had 3 users. 1 has the reply only, 1 has the reply and create, 1 has create
Here is what functions well :
- You have no link to create a new message if you only have the reply only permission
- Visiting messages/new is restricted, of course
- You have a reply form in messages you've received, however.
- The 2 users with the create permission can create new threads.
I think this can make it into the 2.x-dev branch ?
Comment #31
YK85 commentedAllowing users of a role to have "Reply Only" is a great new feature I think, but I'm confused on it being a permission. So if you want a role to be allowed to Send and Reply, then we don't check this on the permissions page? It sounds more of a setting (ie that would be found in the User Blocking Rules page) where it would say something like "Send and Reply Role access" and roles can be added to the "Reply Only". Just wondering from a usability perspective..sorry I don't know programming =( Thanks!
Comment #32
artscoop commentedHi,
If you want a role to be able to Send or Reply, you must check the Write new messages permission.
If you do so, adding the Reply only permission is redundant.
I think it's more natural as a permission.
Comment #33
berdir#31 is a valid concern, but I think a permission is more natural too. Giving the permission to users which have create private message permission is redundant but does not break anything, permissions can only ever allow something, not disallow.
We can probably address this better in Drupal 7 because we have descriptions for permissions there. We just need a good description there then, help is very welcome on that part.
Adding "reply only" to the user blocking rules would be a interesting feature, but imho a different one, which should be handled in a different issue if someone is interested in that.
Thanks for testing, I will probably commit this soon, still hoping for a few simple tests as described in #13/#19. Anyone is invited to try writing a few tests, you can ask me directly in #drupal or here, I'm happy to guide you through the process of writing a test.
Comment #34
berdir#25: privatemsg-572374.patch queued for re-testing.
Comment #36
BenK commentedKeeping track of this thread so that maybe I can help with testing...
Comment #37
berdir#25: privatemsg-572374.patch queued for re-testing.
Comment #38
berdirThe patch still applies, those were just the broken roles tests which I've disabled for now.
Comment #39
BenK commentedI'll test this soon...
--Ben
Comment #40
joostvdl commentedI still didn't have the time to look in to the testing. I Have to find out how testing is working before I can write some testing rules. Looking at my schedule.... this will not going to happen soon :-(
Comment #41
BenK commentedHey Berdir,
I tested the patch in #25 under a few different scenarios and everything worked well. So I think this is ready to be committed (unless you want to add some automated tests first). It's a nice feature. I'll help with testing the D7 version as soon as we have a port.
--Ben
Comment #42
berdirThanks for testing, this has waited long enough. Commited to 6.x-2.x.
I'll port this to D7 and then we can change this to a task to add tests for this feature.
Comment #43
berdirLet's see if this passes.
Comment #44
berdirComment #45
berdirCommitted to 7.x-1.x.
Changing this to a task to add tests for this feature.
Comment #46
oadaeh commentedThis issue is being closed because it is against a branch for a version of Drupal that is no longer supported.
If you feel that this issue is still valid, feel free to re-open and update it (and any possible patch) to work with the 7.x-1.x branch (bug fixes only) or the 7.x-2.x branch.
Thank you.