Skip to content

Commit 5b573f6

Browse files
author
Thomas Horta
committed
Fix tag list check logic to avoid saving same data to DB
IMPORTANT: this breaks ReaderPostListFragment/ViewModel fetch logic because it was relying on this bug causing FollowedTagsChanged to be triggered in the EventBus all the time. With this fix the Subscriptions feed is completely broken (and the other feeds that use this Fragments are likely to be broken as well, which are all the other except Discover).
1 parent 393c1ec commit 5b573f6

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

WordPress/src/main/java/org/wordpress/android/datasets/ReaderTagTable.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ public static ReaderTagList getBookmarkTags() {
232232
return getTagsOfType(ReaderTagType.BOOKMARKED);
233233
}
234234

235+
public static ReaderTagList getDiscoverPostCardsTags() {
236+
return getTagsOfType(ReaderTagType.DISCOVER_POST_CARDS);
237+
}
238+
235239
private static ReaderTagList getTagsOfType(ReaderTagType tagType) {
236240
String[] args = {Integer.toString(tagType.toInt())};
237241
Cursor c = ReaderDatabase.getReadableDb()

WordPress/src/main/java/org/wordpress/android/models/ReaderTagList.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public boolean isSameList(ReaderTagList otherList) {
4444
return false;
4545
} else if (!otherTag.getTagTitle().equals(this.get(i).getTagTitle())) {
4646
return false;
47+
} else if (!otherTag.getTagDisplayName().equals(this.get(i).getTagDisplayName())) {
48+
return false;
4749
}
4850
}
4951

WordPress/src/main/java/org/wordpress/android/ui/reader/services/update/ReaderUpdateLogic.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,9 @@ public void run() {
176176
localTopics.addAll(ReaderTagTable.getFollowedTags());
177177
localTopics.addAll(ReaderTagTable.getBookmarkTags());
178178
localTopics.addAll(ReaderTagTable.getCustomListTags());
179+
localTopics.addAll(ReaderTagTable.getDiscoverPostCardsTags());
179180

180-
if (
181-
!localTopics.isSameList(serverTopics)
182-
|| displayNameUpdateWasNeeded
183-
) {
181+
if (!localTopics.isSameList(serverTopics)) {
184182
AppLog.d(AppLog.T.READER, "reader service > followed topics changed "
185183
+ "updatedDisplayNames [" + displayNameUpdateWasNeeded + "]");
186184

0 commit comments

Comments
 (0)