Requires the commit of #1033338: privatemsg_user_load should handle array of user ids.

In my implementation of prvatemsg I've done this in the sql alter hook, but this would add it to the default. This allows lists of recipients to include all non-hidden recipients (users, roles, etc.).

Patch coming.

Comments

te-brian’s picture

StatusFileSize
new881 bytes

Alright, this is definitely just the start. This should give you an idea what I'm going for.

There are probably other places we want to mimic this. Also, the list sql itself can probably have the "type IN ('user', 'hidden')" removed, but I haven't tested if that is true or not.

Also, poor pgsql needs to be accounted for.

Note: not marking 'needs review' yet because it will definitely not pass tests.

BenK’s picture

Subscribing

berdir’s picture

Status: Active » Needs review

(Tests) Maybe not, but let's try anyway.

We don't verify in the tests that roles and so on don't show up, so the tests will even pass. We should however update them now to verify that the roles show up :)

Status: Needs review » Needs work

The last submitted patch, 1034378_list_sql_concat.patch, failed testing.

berdir’s picture

*slaps head*

Yeah, the other issue, sure :)

te-brian’s picture

Yep :)

That's a boatload of calls to privatemsg_user_load() (good thing it has static caching :)

berdir’s picture

Status: Needs work » Needs review

#1: 1034378_list_sql_concat.patch queued for re-testing.

berdir’s picture

StatusFileSize
new1.71 KB

Ok, here is a patch that works for PostgreSQL too.

te-brian’s picture

It is a testament to the solid use of API functions that such a huge change to the output of a query passes all tests!

berdir’s picture

Status: Needs review » Patch (to be ported)

Well, there was one change necessary, but that already happened in another issue :)

Commited, will need to be ported to 7.x.

berdir’s picture

Version: » 7.x-1.x-dev
berdir’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new12.76 KB

Ok, attaching a patch for 7.x. This also includes the necessary changes for #1033338: privatemsg_user_load should handle array of user ids.

There was some cleaning up to do. Our own load wrapper function now only accepts an array in D7, all other calls for author or other user objects that do not require type have been switched to user_load(), as that already has a static cache in 7.x

Status: Needs review » Needs work

The last submitted patch, 1034378_list_sql_concat_for_7.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1034378_list_sql_concat_for_7.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
berdir’s picture

Status: Needs review » Fixed

Commited.

andypost’s picture

Suppose this code should be checked for compatibility with sqlite & pgsql

berdir’s picture

PostgreSQL should work, sqlite not so much :)

The way it is currently solved is crap and slow anyway, it should be replaced with/in #647212: Load participants in thread list in a single but separate query but that is not trivial to implement.

berdir’s picture

Turned out that it did not :)

I've run the tests on PostgreSQL and fixed two bugs, one because of this patch and another that already existed but was discovered by new tests.

berdir’s picture

And now commited a fix for sqlite compatibility. That was easier than I thought, I just had to remove the "SEPARATOR ','" part, because although sqlite supports group_concat(), that part of the syntax is different. Both mysql and sqlite default to "," though, so that's fine.

Interestingly, the tests are rather fast with sqlite on tmpfs than compared to Postgresql (5 vs. 15min...)

andypost’s picture

using tmpfs for mysql testing env is preffered too but probably could lead to db inconsistency on rsync

Status: Fixed » Closed (fixed)

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