Merge pull request #1415 from annando/1502-like-no-update-commented

New Global setting: like shouldn't set "commented"
This commit is contained in:
Tobias Diekershoff 2015-02-28 08:15:12 +01:00
commit f1b0258fdd
2 changed files with 20 additions and 10 deletions

View file

@ -1434,12 +1434,18 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
$arr['deleted'] = $parent_deleted; $arr['deleted'] = $parent_deleted;
// update the commented timestamp on the parent // update the commented timestamp on the parent
// Only update "commented" if it is really a comment
q("UPDATE `item` set `commented` = '%s', `changed` = '%s' WHERE `id` = %d", if (($arr['verb'] == ACTIVITY_POST) OR !get_config("system", "like_no_comment"))
dbesc(datetime_convert()), q("UPDATE `item` SET `commented` = '%s', `changed` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($parent_id) dbesc(datetime_convert()),
); intval($parent_id)
);
else
q("UPDATE `item` SET `changed` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()),
intval($parent_id)
);
if($dsprsig) { if($dsprsig) {
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",

View file

@ -705,12 +705,16 @@ die("ss");
// Fetch a page full of parent items for this page // Fetch a page full of parent items for this page
if($update) { if($update) {
if (!get_config("system", "like_no_comment"))
$sql_extra4 = "(`item`.`deleted` = 0 OR `item`.`verb` = '".ACTIVITY_LIKE."' OR `item`.`verb` = '".ACTIVITY_DISLIKE."')";
else
$sql_extra4 = "`item`.`deleted` = 0";
$r = q("SELECT `item`.`parent` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` $r = q("SELECT `item`.`parent` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid`
FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND $sql_extra4
(`item`.`deleted` = 0 OR `item`.`verb` = '" . ACTIVITY_LIKE ."' OR `item`.`verb` = '" . ACTIVITY_DISLIKE . "') AND `item`.`moderated` = 0 AND `item`.`unseen` = 1
and `item`.`moderated` = 0 and `item`.`unseen` = 1
$sql_extra3 $sql_extra $sql_nets ORDER BY `item_id` DESC LIMIT 100", $sql_extra3 $sql_extra $sql_nets ORDER BY `item_id` DESC LIMIT 100",
intval(local_user()) intval(local_user())
); );