aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-09-24 16:40:36 -0700
committerredmatrix <mike@macgirvin.com>2016-09-24 16:40:36 -0700
commit39dc4fc99224659ec3f7b808f419892b81052323 (patch)
treec0414e6c46fb1fd1d0e928071bf5930d339eb1d8
parent14e2a5cc39557ea4babbe28d407a64b57a9091c0 (diff)
parent8333d41dbda035d8adf6a3be7e22c77c205071b4 (diff)
downloadvolse-hubzilla-39dc4fc99224659ec3f7b808f419892b81052323.tar.gz
volse-hubzilla-39dc4fc99224659ec3f7b808f419892b81052323.tar.bz2
volse-hubzilla-39dc4fc99224659ec3f7b808f419892b81052323.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
-rw-r--r--include/message.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/message.php b/include/message.php
index 0ba1978f0..0829ebaaa 100644
--- a/include/message.php
+++ b/include/message.php
@@ -299,14 +299,30 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) {
break;
case 'combined':
- $sql = "SELECT * FROM ( SELECT * FROM mail WHERE channel_id = $local_channel ORDER BY created DESC $limit ) AS temp_table GROUP BY parent_mid ORDER BY created DESC";
+ $parents = q("SELECT parent_mid FROM mail WHERE mid = parent_mid AND channel_id = %d ORDER BY created DESC",
+ dbesc($local_channel)
+ );
+ //FIXME: We need the latest mail of a thread here. This query throws errors in postgres. We now look for the latest in php until somebody can fix this...
+ //$sql = "SELECT * FROM ( SELECT * FROM mail WHERE channel_id = $local_channel ORDER BY created DESC $limit ) AS temp_table GROUP BY parent_mid ORDER BY created DESC";
break;
}
}
- $r = q($sql);
+ if($parents) {
+ foreach($parents as $parent) {
+ $all[] = q("SELECT * FROM mail WHERE parent_mid = '%s' AND channel_id = %d ORDER BY created DESC",
+ dbesc($parent['parent_mid']),
+ dbesc($local_channel)
+ );
+ }
+ foreach($all as $single)
+ $r[] = $single[0];
+ }
+ else {
+ $r = q($sql);
+ }
if(! $r) {
return array();