allow photos without comments to be liked
This commit is contained in:
parent
59e19a1f45
commit
5abd01f072
17
mod/like.php
17
mod/like.php
@ -209,13 +209,17 @@ function like_content(&$a) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
// this is used to like an item or comment
|
||||||
|
|
||||||
$item_id = ((argc() == 2) ? notags(trim(argv(1))) : 0);
|
$item_id = ((argc() == 2) ? notags(trim(argv(1))) : 0);
|
||||||
|
|
||||||
logger('like: verb ' . $verb . ' item ' . $item_id, LOGGER_DEBUG);
|
logger('like: verb ' . $verb . ' item ' . $item_id, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
// get the item. Allow linked photos (which are normally hidden) to be liked
|
||||||
|
|
||||||
$r = q("SELECT * FROM item WHERE id = %d and item_restrict = 0 LIMIT 1",
|
$r = q("SELECT * FROM item WHERE id = %d and (item_restrict = 0 or item_restrict = %d) LIMIT 1",
|
||||||
dbesc($item_id)
|
dbesc($item_id),
|
||||||
|
dbesc(ITEM_HIDDEN)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $item_id || (! $r)) {
|
if(! $item_id || (! $r)) {
|
||||||
@ -325,6 +329,15 @@ function like_content(&$a) {
|
|||||||
if($item['item_flags'] & ITEM_WALL)
|
if($item['item_flags'] & ITEM_WALL)
|
||||||
$item_flags |= ITEM_WALL;
|
$item_flags |= ITEM_WALL;
|
||||||
|
|
||||||
|
// if this was a linked photo and was hidden, unhide it.
|
||||||
|
|
||||||
|
if($item['item_restrict'] & ITEM_HIDDEN) {
|
||||||
|
$r = q("update item set item_restrict = (item_restrict ^ %d) where id = %d limit 1",
|
||||||
|
intval(ITEM_HIDDEN),
|
||||||
|
intval($item['id'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($verb === 'like')
|
if($verb === 'like')
|
||||||
|
@ -1 +1 @@
|
|||||||
2014-10-25.839
|
2014-10-26.840
|
||||||
|
Reference in New Issue
Block a user