experimental tweak to not mark articles newer than last one loaded in the buffer as read
This commit is contained in:
parent
c21a462d52
commit
184f51952c
3 changed files with 39 additions and 10 deletions
|
@ -646,8 +646,9 @@ class RPC extends Protected_Handler {
|
|||
function catchupFeed() {
|
||||
$feed_id = db_escape_string($_REQUEST['feed_id']);
|
||||
$is_cat = db_escape_string($_REQUEST['is_cat']) == "true";
|
||||
$max_id = (int) db_escape_string($_REQUEST['max_id']);
|
||||
|
||||
catchup_feed($this->link, $feed_id, $is_cat);
|
||||
catchup_feed($this->link, $feed_id, $is_cat, false, $max_id);
|
||||
|
||||
print json_encode(array("message" => "UPDATE_COUNTERS"));
|
||||
}
|
||||
|
|
|
@ -1320,12 +1320,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
function catchup_feed($link, $feed, $cat_view, $owner_uid = false) {
|
||||
function catchup_feed($link, $feed, $cat_view, $owner_uid = false, $max_id = false) {
|
||||
|
||||
if (!$owner_uid) $owner_uid = $_SESSION['uid'];
|
||||
|
||||
//if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {
|
||||
|
||||
$ref_check_qpart = ($max_id) ? "ref_id <= '$max_id'" : "true";
|
||||
|
||||
if (is_numeric($feed)) {
|
||||
if ($cat_view) {
|
||||
|
||||
|
@ -1346,34 +1348,43 @@
|
|||
|
||||
db_query($link, "UPDATE ttrss_user_entries
|
||||
SET unread = false,last_read = NOW()
|
||||
WHERE feed_id = '$tmp_feed' AND owner_uid = $owner_uid");
|
||||
WHERE feed_id = '$tmp_feed'
|
||||
AND $ref_check_qpart
|
||||
AND owner_uid = $owner_uid");
|
||||
}
|
||||
} else if ($feed == -2) {
|
||||
|
||||
db_query($link, "UPDATE ttrss_user_entries
|
||||
SET unread = false,last_read = NOW() WHERE (SELECT COUNT(*)
|
||||
FROM ttrss_user_labels2 WHERE article_id = ref_id) > 0
|
||||
AND unread = true AND owner_uid = $owner_uid");
|
||||
AND $ref_check_qpart
|
||||
AND unread = true AND owner_uid = $owner_uid");
|
||||
}
|
||||
|
||||
} else if ($feed > 0) {
|
||||
|
||||
db_query($link, "UPDATE ttrss_user_entries
|
||||
SET unread = false,last_read = NOW()
|
||||
WHERE feed_id = '$feed' AND owner_uid = $owner_uid");
|
||||
WHERE feed_id = '$feed'
|
||||
AND $ref_check_qpart
|
||||
AND owner_uid = $owner_uid");
|
||||
|
||||
} else if ($feed < 0 && $feed > -10) { // special, like starred
|
||||
|
||||
if ($feed == -1) {
|
||||
db_query($link, "UPDATE ttrss_user_entries
|
||||
SET unread = false,last_read = NOW()
|
||||
WHERE marked = true AND owner_uid = $owner_uid");
|
||||
WHERE marked = true
|
||||
AND $ref_check_qpart
|
||||
AND owner_uid = $owner_uid");
|
||||
}
|
||||
|
||||
if ($feed == -2) {
|
||||
db_query($link, "UPDATE ttrss_user_entries
|
||||
SET unread = false,last_read = NOW()
|
||||
WHERE published = true AND owner_uid = $owner_uid");
|
||||
WHERE published = true
|
||||
AND $ref_check_qpart
|
||||
AND owner_uid = $owner_uid");
|
||||
}
|
||||
|
||||
if ($feed == -3) {
|
||||
|
@ -1405,7 +1416,7 @@
|
|||
if ($feed == -4) {
|
||||
db_query($link, "UPDATE ttrss_user_entries
|
||||
SET unread = false,last_read = NOW()
|
||||
WHERE owner_uid = $owner_uid");
|
||||
WHERE $ref_check_qpart AND owner_uid = $owner_uid");
|
||||
}
|
||||
|
||||
} else if ($feed < -10) { // label
|
||||
|
@ -1415,6 +1426,7 @@
|
|||
db_query($link, "UPDATE ttrss_user_entries, ttrss_user_labels2
|
||||
SET unread = false, last_read = NOW()
|
||||
WHERE label_id = '$label_id' AND unread = true
|
||||
AND $ref_check_qpart
|
||||
AND owner_uid = '$owner_uid' AND ref_id = article_id");
|
||||
|
||||
}
|
||||
|
@ -1432,7 +1444,7 @@
|
|||
while ($line = db_fetch_assoc($result)) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
unread = false, last_read = NOW()
|
||||
WHERE int_id = " . $line["post_int_id"]);
|
||||
WHERE $ref_check_qpart AND int_id = " . $line["post_int_id"]);
|
||||
}
|
||||
db_query($link, "COMMIT");
|
||||
}
|
||||
|
|
|
@ -480,6 +480,8 @@ function catchupFeedInGroup(id) {
|
|||
|
||||
function catchupFeed(feed, is_cat) {
|
||||
try {
|
||||
if (is_cat == undefined) is_cat = false;
|
||||
|
||||
var str = __("Mark all articles in %s as read?");
|
||||
var fn = getFeedName(feed, is_cat);
|
||||
|
||||
|
@ -489,8 +491,22 @@ function catchupFeed(feed, is_cat) {
|
|||
return;
|
||||
}
|
||||
|
||||
var max_id = 0;
|
||||
|
||||
if (feed = getActiveFeedId() && is_cat == activeFeedIsCat()) {
|
||||
$$("#headlines-frame > div[id*=RROW]").each(
|
||||
function(child) {
|
||||
var id = parseInt(child.id.replace("RROW-", ""));
|
||||
|
||||
if (id > max_id) max_id = id;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var catchup_query = "?op=rpc&method=catchupFeed&feed_id=" +
|
||||
feed + "&is_cat=" + is_cat;
|
||||
feed + "&is_cat=" + is_cat + "&max_id=" + max_id;
|
||||
|
||||
console.log(catchup_query);
|
||||
|
||||
notify_progress("Loading, please wait...", true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue