Fix GROUP BY in acl_selector, api, notifier, photos, messages
https://github.com/friendica/friendica/issues/3322
This commit is contained in:
parent
c3e933642e
commit
74b6d09e89
7 changed files with 14 additions and 12 deletions
|
|
@ -502,7 +502,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
|||
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`
|
||||
WHERE NOT `group`.`deleted` AND `group`.`uid` = %d
|
||||
$sql_extra
|
||||
GROUP BY `group`.`name`
|
||||
GROUP BY `group`.`name`, `group`.`id`
|
||||
ORDER BY `group`.`name`
|
||||
LIMIT %d,%d",
|
||||
intval(local_user()),
|
||||
|
|
@ -619,7 +619,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
|||
FROM `item` WHERE `parent` = %d
|
||||
AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%')
|
||||
AND `author-link` NOT IN ('%s')
|
||||
GROUP BY `author-link`
|
||||
GROUP BY `author-link`, `author-avatar`, `author-name`
|
||||
ORDER BY `author-name` ASC
|
||||
",
|
||||
intval($conv_id),
|
||||
|
|
|
|||
|
|
@ -3064,7 +3064,7 @@ use \Friendica\Core\Config;
|
|||
function api_fr_photos_list($type) {
|
||||
if (api_user()===false) throw new ForbiddenException();
|
||||
$r = q("select `resource-id`, max(scale) as scale, album, filename, type from photo
|
||||
where uid = %d and album != 'Contact Photos' group by `resource-id`",
|
||||
where uid = %d and album != 'Contact Photos' group by `resource-id`, album, filename, type",
|
||||
intval(local_user())
|
||||
);
|
||||
$typetoext = array(
|
||||
|
|
@ -3102,8 +3102,10 @@ use \Friendica\Core\Config;
|
|||
$data_sql = ($scale === false ? "" : "data, ");
|
||||
|
||||
$r = q("select %s `resource-id`, `created`, `edited`, `title`, `desc`, `album`, `filename`,
|
||||
`type`, `height`, `width`, `datasize`, `profile`, min(`scale`) as minscale, max(`scale`) as maxscale
|
||||
from photo where `uid` = %d and `resource-id` = '%s' %s group by `resource-id`",
|
||||
`type`, `height`, `width`, `datasize`, `profile`, min(`scale`) as minscale, max(`scale`) as maxscale
|
||||
from photo where `uid` = %d and `resource-id` = '%s' %s
|
||||
group by `resource-id`, `created`, `edited`, `title`, `desc`, `album`, `filename`,
|
||||
`type`, `height`, `width`, `datasize`, `profile`",
|
||||
$data_sql,
|
||||
intval(local_user()),
|
||||
dbesc($_REQUEST['photo_id']),
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ function notifier_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
$r1 = q("SELECT DISTINCT(`batch`), `id`, `name`,`network` FROM `contact` WHERE `network` = '%s'
|
||||
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch` ORDER BY rand()",
|
||||
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`, `id` ORDER BY rand()",
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
intval($owner['uid']),
|
||||
intval(CONTACT_IS_SHARING)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ function photo_albums($uid, $update = false) {
|
|||
$albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`
|
||||
FROM `photo`
|
||||
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
|
||||
GROUP BY `album` ORDER BY `created` DESC",
|
||||
GROUP BY `album`, `created` ORDER BY `created` DESC",
|
||||
intval($uid),
|
||||
dbesc('Contact Photos'),
|
||||
dbesc(t('Contact Photos'))
|
||||
|
|
@ -61,7 +61,7 @@ function photo_albums($uid, $update = false) {
|
|||
$albums = qu("SELECT DISTINCT(`album`), '' AS `total`
|
||||
FROM `photo`
|
||||
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
|
||||
GROUP BY `album` ORDER BY `created` DESC",
|
||||
GROUP BY `album`, `created` ORDER BY `created` DESC",
|
||||
intval($uid),
|
||||
dbesc('Contact Photos'),
|
||||
dbesc(t('Contact Photos'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue