Skip to content

Commit 9968d46

Browse files
author
Andrew Dolgov
committed
send_headline_digests: properly handle owner uid when marking articles as read
1 parent 0cacc89 commit 9968d46

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

functions.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -3250,7 +3250,7 @@ function send_headlines_digests($link, $limit = 100) {
32503250

32513251
if ($rc) {
32523252
print "Marking affected articles as read...\n";
3253-
catchupArticlesById($link, $affected_ids, 0);
3253+
catchupArticlesById($link, $affected_ids, 0, $line["id"]);
32543254
}
32553255

32563256
db_query($link, "UPDATE ttrss_users SET last_digest_sent = NOW()
@@ -3446,7 +3446,9 @@ function publishArticlesById($link, $ids, $cmode) {
34463446
}
34473447
}
34483448

3449-
function catchupArticlesById($link, $ids, $cmode) {
3449+
function catchupArticlesById($link, $ids, $cmode, $owner_uid = false) {
3450+
3451+
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
34503452

34513453
$tmp_ids = array();
34523454

@@ -3459,15 +3461,15 @@ function catchupArticlesById($link, $ids, $cmode) {
34593461
if ($cmode == 0) {
34603462
db_query($link, "UPDATE ttrss_user_entries SET
34613463
unread = false,last_read = NOW()
3462-
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
3464+
WHERE ($ids_qpart) AND owner_uid = $owner_uid");
34633465
} else if ($cmode == 1) {
34643466
db_query($link, "UPDATE ttrss_user_entries SET
34653467
unread = true
3466-
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
3468+
WHERE ($ids_qpart) AND owner_uid = $owner_uid");
34673469
} else {
34683470
db_query($link, "UPDATE ttrss_user_entries SET
34693471
unread = NOT unread,last_read = NOW()
3470-
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
3472+
WHERE ($ids_qpart) AND owner_uid = $owner_uid");
34713473
}
34723474
}
34733475

0 commit comments

Comments
 (0)