Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disappearing saved posts #8960

Merged
merged 4 commits into from Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
@@ -1,2 +1,3 @@
* Add Importing from Giphy in Editor and Media Library
* Adds support for .blog subdomains on new sites.
* Fixed a bug causing disappearance of old saved posts
Expand Up @@ -243,10 +243,11 @@ private static int purgePostsForTag(SQLiteDatabase db, ReaderTag tag) {
if (numPosts <= MAX_POSTS_PER_TAG) {
return 0;
}

String[] args = {tag.getTagSlug(), Integer.toString(tag.tagType.toInt()), Integer.toString(MAX_POSTS_PER_TAG)};
String where = "pseudo_id NOT IN (SELECT DISTINCT pseudo_id FROM tbl_posts WHERE tag_name=? AND "
+ "tag_type=? ORDER BY " + getSortColumnForTag(tag) + " DESC LIMIT ?)";
String tagName = tag.getTagSlug();
String tagType = Integer.toString(tag.tagType.toInt());
String[] args = {tagName, tagType, tagName, tagType, Integer.toString(MAX_POSTS_PER_TAG)};
String where = "tag_name=? AND tag_type=? AND pseudo_id NOT IN (SELECT DISTINCT pseudo_id FROM tbl_posts WHERE "
+ "tag_name=? AND tag_type=? ORDER BY " + getSortColumnForTag(tag) + " DESC LIMIT ?)";
int numDeleted = db.delete("tbl_posts", where, args);
AppLog.d(AppLog.T.READER,
String.format(Locale.ENGLISH, "reader post table > purged %d posts in tag %s", numDeleted,
Expand Down