}
}
- 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) {
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) {
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
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");
}
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");
}
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);
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);