Closed (fixed)
Project:
Privatemsg
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2008 at 16:54 UTC
Updated:
14 Sep 2008 at 21:13 UTC
Jump to comment: Most recent file
Attached patch is a quick and dirty update to show all the messages in a thread.
It shows all the messages, but to make this useful, the theming needs to be improved a little too.
| Comment | File | Size | Author |
|---|---|---|---|
| #41 | privatemsg_thread.patch | 11.48 KB | naheemsays |
| #38 | privatemsg_thread.patch | 11.49 KB | naheemsays |
| #37 | privatemsg_thread.patch | 11.49 KB | naheemsays |
| #36 | privatemsg_thread.patch | 10.76 KB | naheemsays |
| #34 | privatemsg_thread.patch | 10.44 KB | naheemsays |
Comments
Comment #1
naheemsays commentedI need to figure out how to add a reply box under the messages too.
Comment #2
litwol commentedThis is the reason i have the thread_id in the database schema. right now its not used much.
the problem with threaded versus non threaded message listing is that you cant re-use the same queries on the same database schema and still have the query efficient. more correctly i think you CAN but i havent figured out the correct query to make it work.
My concern is to have this functionality work with no performance degradation regardless if you show threaded or non threaded discussion.
I am fine with defaulting to threaded-only format, but i havent decided whether i should be so strict. help me decide please.
Comment #3
naheemsays commentedI say go with threaded (within limits - each recipient should IMO have a different thread_id so that all conversations are within two people) and stick to it. Do something and do it well.
As for optimising the database queries, unfortunately, all can do is trial and error (with the occasional eureka moment). sql is not something I know much about.
The listing query is a little complicated something I am just starting to get my head around.
Unfortunately, I am not too much more than a cheerleader.
Comment #4
litwol commented@nbz: i wrote the whole query builder myself from scratch. it is not something you can find documentation about online or on drupal handbook...
so if you'd like to find out more about it i will be more than happy to explain it to you if we speak on IRC.
in http://drupal.org/irc you will find instructions on how to get to #drupal. one you are in #drupal you should ping me (litwol) and we'll chat.
Comment #5
naheemsays commentedGot any recommendation for a windows irc client?
(What I want to know about that code is how to select the recipient id.)
PS got any links to generic Joins/basic SQL related tutorials? I have no idea what the letters in the letters.fieldname stand for.
Comment #6
litwol commentedi use http://www.mirc.com/
i'll explain everything when you get on irc.
Comment #7
naheemsays commentedok, pinged you.
Comment #8
naheemsays commentedI have merged this patch into larger patch at #299491: Put a reply form on the message page as that required this anyway.
Comment #9
naheemsays commentedSeparate the threading stuff back into a new patch.
Comment #10
naheemsays commentedUpdated patch to fix point 4 in comment 12 in #299491: Put a reply form on the message page:
Comment #11
naheemsays commentedoops - should not use that query to restrict to author recipient. That is done elsewhere.
Comment #12
naheemsays commentedComment #13
mrtoner commentedPatch in #12 doesn't apply:
Comment #14
naheemsays commentedUpdates patch (and thanks for the reviews.)
Comment #15
naheemsays commentedAnd ignore that patch :P
working patch attached.
Comment #16
mrtoner commentedAh, that works! Say, what is your thinking in removing this?
- $output = theme('privatemsg_to', $message);And what is it that this line does (or did before you removed it)? I'm not up on the Forms API:
- $form_state['rebuild'] = true; //rebuild this message for ease of useCan we set the breadcrumb for the view page here? (Home >> Private messages) Callbacks apparently don't do that automatically like local tasks do.
Comment #17
naheemsays commentedThe first bit adds a "conversation between x , y and z" line above the messages and is potentially broken in a threaded view. What needs to be done is show the recipients per message.
The second line re fills in the form with the data you sent. Good for testing as you can hit submit 10 times in a row and get ten messages submitted without the need to change the subject/recipients/body.
I will look into #3.
Comment #18
Babalu commentedPatch #15
patching file privatemsg.module
Hunk #2 FAILED at 357.
Hunk #3 FAILED at 488.
Hunk #4 succeeded at 596 (offset 3 lines).
Hunk #5 succeeded at 641 (offset 6 lines).
Hunk #6 succeeded at 658 (offset 6 lines).
2 out of 6 hunks FAILED
Comment #19
naheemsays commentedWas that applied against HEAD?
Comment #20
mrtoner commentedYeah, I understand what it's supposed to do, but I don't see (in privatemsg_preprocess_privatemsg_to() ) how this could be broken. If, per our previous conversation, replies to a thread cannot change the recipients, then each message will have the same recipients as other messages in the thread.
(That's not completely true, since it's possible for a user to be dropped from a thread if they no longer exist or if they no longer have permissions.)
Can we/should we iterate over all the recipients in the thread instead? If this feature is broken by threading, then it seems we should fix the feature instead of simply removing it.
Thanks. The Forms API documentation doesn't quite make sense to me. It probably makes sense to someone that's been working with it a while, but I'm still trying to get my head wrapped around menus. The description "The 'rebuild' key overrides the 'redirect' key: when it is set to TRUE, the form will be rebuilt from scratch and displayed on screen" doesn't indicate that the form values are retained.
Something like this should do it:
Comment #21
naheemsays commentedI have previously discussed the privatemsg_to situation with litwol and I think we came to the conclusion it was best to show recipients per message.
That may no longer be the case though as my other patch plain disallows users from changing recipients.
The function is (assumed) broken as there is no longer a single mid fed to it, but that could be fixed if we want to retain that feature.
Question about the breadcrumb - what do we want to change? on my test site, they are showing up ("Home > Private Messages")
Comment #22
mrtoner commentedSince the message recipients are the same each time a message is fed to the function (if using your other patch), $vars['recipients'] will always be the same, except in the instances I noted. Still, the theme call could be moved so the function only gets called once -- and so that users no longer in the conversation are included, but not linked.
The breadcrumb for "Read private message" on my site is "Home" instead of "Home > Private messages."
Comment #23
naheemsays commentedIt is broken as the function tries to set an "author" when a thread has multiple authors. Most of the code is actually already there to get the recipients (three lines - 371-373 - need to be uncommented), but the privatemsg_preprocess_privatemsg_to function needs to be altered to work correctly.
Comment #24
naheemsays commentedI think anything outstanding should probably covered in a separate issue.
Current deficiencies - there is no indication in the message as to who the recipients are.
Comment #25
mrtoner commentedI made a couple formatting changes, but this is basically #24.I'm unclear on the purpose of the max() function in the _alter routines. max() expects an array, does it not?Comment #26
naheemsays commentedIt shows the max mid per group of mids with the same thread_id
Comment #27
mrtoner commentedNevermind. MAX() is a MySQL function in this case, not a PHP function. Patch in #24 is good to go.
Comment #28
naheemsays commentedHopefully final patch - adds participants to the top of the message as requested in comment 16 and removes function privatemsg_privatemsg_recipients_alter as that is no longer used (and the required query cannot fit in there as it contains a UNION)
Comment #29
litwol commentedWhen posting new patch please set the code needs review
Comment #30
naheemsays commentedoops - sorry.
Comment #31
mrtoner commentedPatch works. Whether or not the way we're making database queries is correct is litwol's call, though.
Oh, the template and css file names need to be changed to include "participant" instead of "recipient" (for consistency).
Comment #32
litwol commentedinstead of coding around query builder limitations we should patch query builder to allow us executing the quries we need. If we don't use query builder then we disallow other modules easy integration.
I really want to get this issue resolved and commited soon. But only if we fix the query builder in this or very next patch.
Comment #33
taqwa commentedIs this feature already present for the Drupal 5 version of this module?
Comment #34
naheemsays commented1. Updated the query builder - @ litwol when we get to adding the delete functionality, the privatemsg_privatemsg_list_alter function would probably need to be changed to include a JOIN (maybe more) but it is probably be better to leave that til we need it.
2. Links are now to the thread_id, and the view function also works off the the thread_id instead of the more generic mid. This simplifies the query needed to get a list of all mid in a thread as there is no longer a need for a JOIN.
Comment #35
naheemsays commented@lukas2000 - yes.
Comment #36
naheemsays commentedMove another query into the query builder.
Comment #37
naheemsays commented1. hopefully completed any changes needed for the query builder.
2. Expanded on privatemsg_privatemsg_messages_alter to also work as expected in the case where not all the messages in a thread are viewable for all members of the thread. (This should not happen when the drupal 6 version of the module is used, but is a corner case when upgrading from Drupal 5 as afaik that allowed people to change who received follow up messages in a thread.)
Comment #38
naheemsays commentedThere was a line with incorrect tabbing.
PS the form of privatemsg_privatemsg_message_alter is as it is on purpose so that extending that function (for the delete support) does not entail rewriting the function.
Comment #39
mrtoner commentedI haven't aplied the patch yet, but in going over the changes I noticed these issues:
- privatemsg_preprocess_privatemsg_to() doesn't account for threads with only one participant. Highly unlikely, but what happens if a user is deleted?
$query = _privatemsg_assemble_query('privatemsg_participants', $message['thread_id']); -- Should it be ..., $thread_id? Just for consistency?
$query = _privatemsg_assemble_query('privatemsg_participants', $message['thread_id']); -- this assumes no messages have been deleted. Any deleted messages may be the last from/to a given participant, and thus that user will not be listed as a recipient nor get future replies.
Comment #40
naheemsays commentedThe delete stuff comes in a later patch: #291206: Delete Architecture. Having a message deleted should notaffect the participants list with that architecture.
Comment #41
naheemsays commentedChanges $message['thread_id'] to $thread_id.
As for user being deleted, in that case I suppose the theme process will give the user a name of anonymous, or whatever else the drupal settings tell it to do. Same witht he actual message too.
Comment #42
mrtoner commentedJust tested against a deleted user and, yes, theme() returns whatever the site settings have named an anonymous user.
Comment #43
mrtoner commentedAs best as I can tell, threading hasn't changed outwardly since #31. Patch in #41 seems to be doing its job.
Comment #44
naheemsays commentedrolled into #299491: Put a reply form on the message page