Hi,

today I tried filter submodule for privatemessages because I read in commit issues that you moved submenu into main privatemsg menu so I was curious about it.

But I found that under tab "Inbox" I have the same list of messages as it isunder All messages tab.
IMO, and as it is in mail client obviously, there could be only received messages in inbox, not the sent too.

Sent messages list works correct, there are only sent messages.

thanks
Igor

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new759 bytes

Confirmed. The inbox display is only a follow-up error, though.

The real bug is that _privatemsg_send() does create duplicate recipient entries for users with read all permission. This is also the reason for #567242: Mark read messages automatically mark as read, I think..

Please confirm that..

a) This only happens for users with read all permission
b) The attached patch does fix the issue.

igorik’s picture

Hi Berdir,

a) is wrong, my users don't have "Read all messages" permission but they have all messages in inbox. Only admin role has permission "See all messages".
b) it works and it fix issue. (For new messages only). User with basic permission - read messages, can see his new sent message only under Sent messages tab and under All messages tab.

thank you for this quick fix
Igor

P. S. is there some chance to hide already existing sent messages from inbox or it is not possible?

berdir’s picture

Priority: Normal » Critical

a) yep, right, of course..

Regarding hiding of existing messages, unfortunatly, it is not possible. The problem is that we can't distinguish between actually duplicated rows and messages that were sent explicitly sent to the author. We will be able to fix it when #502664: remove duplicate records from pm_index and add primary key is resolved but that might not happen anytime soon.

Setting this to critical, I will commit this asap.

berdir’s picture

StatusFileSize
new11 KB

Attached is a slightly updated patch that also contains tests for both the read all functionality and the correct inbox/sent functiality. Both test methods do have fails with the current -dev release.

I fixed two more related bugs:
- Moved the read_all check to the start of the function so that we don't create an additional recipient entry for the current message.
- Moved the read all notice after drupal_get_form() so that it isn't displayed anymore when you are sending a message.

naheemsays’s picture

Version: » 6.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

pok, this is good to go.

When committing, it may however be a good idea to rename a $resuld to $result - since that is not subsequently used, the actual name however does not matter much.

berdir’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Fixed in 6.x-1.x-dev and 7.x-1.x-dev.

Status: Fixed » Closed (fixed)

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