I think it can be good to know how many unread messages there are in a thread, so just experimenting atm.

Current patch applies after #348907: Per thread/Multiple thread actions and #303087: Move "Sent Messages" to privatemsg_filter, Add inbox, improve user filtering..

What is does:

1. Modify the list query to count the number of unread messages.
2. For unread messaged, chages the displayed subject line with the number of unread messages at the end.
3. adds a #new to the end of the link to messages with new messages.

ToDo:

1. Modify the view page to add a new anchor that the above from #3 links to.

Comments? good idea or bad?

Comments

berdir’s picture

Interesting....

What about using a similar style as in the issue queue:
- Display a new/updated text after the subject, instead of the number of new messages (new: sum() == count(), updated: sum() > 0
- Display the amount of new messages in the answers column: 5 (3 new), where 3 new is a link with #new appended.

Oh, and "&& $thread['is_new'] <> 0" should not be needed, because empty(0) == FALSE.

naheemsays’s picture

StatusFileSize
new1.52 KB

Same as before but rerolled to latest changes in the above two patches and removed teh extra bits that Berdir mentioned.

@ Berdir, good ideas and I will try to incorporate them into the next patch.

naheemsays’s picture

StatusFileSize
new2.01 KB

New patch - the subject goes back to the way it was before - linking to the thread.

The Answers column is renamed to "replies" and also has the number of unread messages below it.

I must say that it looks weird when there are more new messages than replies though, but that is always possible.

berdir’s picture

I'm wondering if we should change that to Messages or so, instead of replies.

Another possibilty would be not to display "x new" for new messages. That's how d.o is doing it, see for example at http://drupal.org/project/issues/search/drupal?version[0]=156281&status[... and look for new issues with 0 replies.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new23.15 KB
new3.27 KB

Re-rolled, changes:

- use theme_mark() to display new/updated instead of a bold subject. This can easily be overwritten if someone wants to them it differently.
- Renamed Reply/Answers to Messages, display the "first" message now too
- Only display number of new messages for "updated" threads

Note: There is still a "bug" when you write a message to yourself.. you are count twice. This is not solvable as part of this patch.

liam mcdermott’s picture

StatusFileSize
new29.21 KB

I'm not liking the 'updated' mark when there are new messages in a thread, I look at a thread with 'new' and a thread with 'updated' and think: 'What's the difference?' Also, to me, 'updated' means the original post has been edited or changed in some way, which is clearly incorrect.

Also, Views doesn't print an upated mark for new comments (see screenshot attached). Maybe this is just tracker.module behaviour? In which case, we should probably mimic Views as tracker is quite likely to be replaced by it in Drupal 7.

naheemsays’s picture

StatusFileSize
new3.48 KB

I disliked the following bit of the patch:

-  drupal_add_css(drupal_get_path('module', 'privatemsg') .'/styles/privatemsg-list.css');
-

As that removed the boldness of the subject, but at the same time, the new/updated text in red did not look good bolded, so I have changed teh CSS to not bold that bit.

Also, I have centered the count column. This last bit may be down to personal preference though, so feel free to remove.

naheemsays’s picture

StatusFileSize
new3.36 KB

and just in case, another version taking into account comment 6.

Saying that, I can see the value of updated vs new as I will in most likelihood NOT be showing the count column, and it will be easier to tell there which conversations are new, and which have posts that have been read previously.

liam mcdermott’s picture

Saying that, I can see the value of updated vs new as I will in most likelihood NOT be showing the count column

With that use case I can see the value of showing something, but it shouldn't be 'updated' in my opinion.

'new replies' or 'unread replies' -- or words to that effect -- would work well. Then the user won't have to learn what 'updated' means in this context. 'updated' is just bad usability. Think of the users! Won't somebody think of the users? ;)

naheemsays’s picture

The patch in comment 8 only shows the word "new" and not updated. Unless we go for new theme functions, or something else, that should probably be good enough I think.

liam mcdermott’s picture

Status: Needs review » Reviewed & tested by the community

This is definitely a step in the right direction, in my opinion. :)

Related to this is: #442042: Give messages anchors as this patch links to #new in the message thread list, this is required to add #new anchors to messages.

naheemsays’s picture

StatusFileSize
new4.94 KB

ok, a combined version of this patch with #442042: Give messages anchors as atleast the acnhors capability is crossing over and is needed in both.

naheemsays’s picture

Status: Reviewed & tested by the community » Needs review
aharown07’s picture

Using this patch. Not qualified to review the code, but in the look and feel dept. it's very nice addition.

JirkaRybka’s picture

Status: Needs review » Needs work

This sounds really nice, but the patch doesn't apply anymore: ALL hunks failed. I'm not attempting a re-roll, as it's likely to be a complete re-write of the patch.

naheemsays’s picture

Status: Needs work » Needs review
StatusFileSize
new4.98 KB

Rerolled - but I also only got 1 hunk to fail when applying the patch, not all of them.

JirkaRybka’s picture

Oh, now I see: The patches here have Windows line-endings (CR+LF). This is difficult to see, as hexadecimal file dump is not exactly common tool, and normal text editors or browsers don't show that, but I quite never found a way to make such patches apply on my Linux-based environment. (Is there some simple way?) Windows suck.

naheemsays’s picture

Any way I can fix the line endings thing?

Have you tried a plain patch command to apply? for me using cygwin that always strips the incorrect line endings away.

JirkaRybka’s picture

I just observed the CR/LF pairs in the file, after dumping it byte-to-byte through a php script. I'm always applying patches by plain command-line 'patch' command on Linux, so that's pretty much "native" environment I guess. But I have nothing more to say to this, sorry. Just stated my findings here, to explain why I got these failures, and that it most probably doesn't affect the real contents of the patch.

berdir’s picture

Status: Needs review » Needs work

some minor coding style stuff, then we can set that to RTBC, as it has been tested on nbz's for quite some time afaik.

+  $vars['message_anchors'][] = 'privatemsg-mid-'.$vars['mid'];

That should contain a space between . and $. Same for some other instances. Hint: D7 has changed coding style to include a space between ' and . too, not sure which one we want to follow. Always having spaces around . is imho better.

+  $fragments['select'][]      = 'SUM(pmi.is_new) as is_new';

We would have to rename some functions, but it might make sense to rename is_new to something like num_new or sum_new, to reflect what it actually is...

JirkaRybka’s picture

SUM(pmi.is_new) as is_new
I suspect this (untested) to have problems on messages sent to oneself, where we have two records for the same message, both set to "new". Since we decided NOT to remove duplicates from the index table over at #490650: Message sent to oneself breaks new/#replies data loading, we need to keep an eye on duplicate-rows-related behavior everywhere.

litwol’s picture

Can we use GROUP BY uid in pm_index to bypass duplicate record?

naheemsays’s picture

Status: Needs review » Needs work
StatusFileSize
new5.04 KB

GROUP BY uid does not work (and a recipient can also receive more than one message in a thread, so how would that work?).

The patch does mitigate the problem though by only showing the count of new messages in a thread if the number is less than the total number of messages.

(the original reasoning for that was that if all messages are new, no need to add a number, but it covers this case in a few places too.)

Either way, the problem is a superficial one and the other things from this patch (the anchors) are IMO much needed, and if/when we find a better solution to duplicate records, we can fix that then. Opinions?

naheemsays’s picture

Status: Needs work » Needs review
JirkaRybka’s picture

Status: Needs work » Needs review

What about grouping by mid ?

naheemsays’s picture

I tried it and that did not work either.

berdir’s picture

Hm, is it correct that we add the "new" anchor to every new message?

According to http://webdesign.about.com/od/htmltags/p/blatnamea.htm, that is not valid: "This attribute names the current anchor so that it can be the destination of another link or anchor. The value must be unique and it shares the same namespace as the id attribute."

Oh, and there is still a spacing issue in the $anchor loop ;)

naheemsays’s picture

About the anchor - it is correct (enough) - the link will go to the first anchor in the page that has the #new and I am quite sure that is how it is done in core too.

naheemsays’s picture

StatusFileSize
new5.3 KB

and the rest of the spacing fixed. hopefully.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Ok, I reviewed the patch in detail and it looks good. I also tested it, it works fine and as expected. Additionally, it generates valid XHTML 1.0 Strict, wohooo! ;)

Let's get this in and RC3 rolled out, it's about time! ;)

litwol’s picture

Status: Reviewed & tested by the community » Fixed

Cheers :)

Status: Fixed » Closed (fixed)

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