Bug 1254797 - Post: Ensure we ignore deleted sites in pinned query r=rnewman, a=ritu

Pinned sites should be deleted directly, however I'm not confident enough
in my knowledge of sync to be certain that we won't end up with deleted
pinned sites in our table.

(We use normal bookmark deletion for removing pinned sites.)

MozReview-Commit-ID: SSLDkSXWlI
This commit is contained in:
Andrzej Hunt 2016-03-15 14:44:13 -07:00
parent f70e7edd48
commit 353729fe04

View File

@ -713,7 +713,9 @@ public class BrowserProvider extends SharedBrowserDatabaseProvider {
suggestedGridLimit = Integer.parseInt(gridLimitParam, 10);
}
final String pinnedSitesFromClause = "FROM " + TABLE_BOOKMARKS + " WHERE " + Bookmarks.PARENT + " == " + Bookmarks.FIXED_PINNED_LIST_ID;
final String pinnedSitesFromClause = "FROM " + TABLE_BOOKMARKS + " WHERE " +
Bookmarks.PARENT + " == " + Bookmarks.FIXED_PINNED_LIST_ID +
" AND " + Bookmarks.IS_DELETED + " IS NOT 1";
// Ideally we'd use a recursive CTE to generate our sequence, e.g. something like this worked at one point:
// " WITH RECURSIVE" +
@ -924,8 +926,7 @@ public class BrowserProvider extends SharedBrowserDatabaseProvider {
Bookmarks.POSITION + ", " +
"NULL AS " + Combined.HISTORY_ID + ", " +
TopSites.TYPE_PINNED + " as " + TopSites.TYPE +
" FROM " + TABLE_BOOKMARKS +
" WHERE " + Bookmarks.PARENT + " == " + Bookmarks.FIXED_PINNED_LIST_ID +
" " + pinnedSitesFromClause +
" ORDER BY " + Bookmarks.POSITION,