Whole in timelines due to cache bug

pull/934/head
Thomas 1 year ago
parent 9b91ebf317
commit be54c49918

@ -555,15 +555,28 @@ public class StatusCache {
String selection = Sqlite.COL_INSTANCE + "='" + instance + "' AND " + Sqlite.COL_USER_ID + "= '" + user_id + "' AND " + Sqlite.COL_TYPE + "= '" + Timeline.TimeLineEnum.NOTIFICATION.getValue() + "' ";
String limit = String.valueOf(MastodonHelper.statusesPerCall(context));
if (min_id != null) {
if (Helper.isNumeric(min_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " > cast(" + min_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + min_id + "' ";
}
order = " ASC";
} else if (max_id != null) {
if (Helper.isNumeric(max_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " < cast(" + max_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " < '" + max_id + "' ";
}
} else if (since_id != null) {
if (Helper.isNumeric(since_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " > cast(" + since_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + since_id + "' ";
limit = null;
}
limit = null;
}
if (exclude_type != null && exclude_type.size() > 0) {
StringBuilder exclude = new StringBuilder();
for (String excluded : exclude_type) {
@ -600,12 +613,25 @@ public class StatusCache {
String selection = Sqlite.COL_INSTANCE + "='" + instance + "' AND " + Sqlite.COL_USER_ID + "= '" + user_id + "' AND " + Sqlite.COL_TYPE + "= '" + Timeline.TimeLineEnum.CONVERSATION.getValue() + "' ";
String limit = String.valueOf(MastodonHelper.statusesPerCall(context));
if (min_id != null) {
if (Helper.isNumeric(min_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " > cast(" + min_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + min_id + "' ";
}
order = " ASC";
} else if (max_id != null) {
if (Helper.isNumeric(max_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " < cast(" + max_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " < '" + max_id + "' ";
}
} else if (since_id != null) {
if (Helper.isNumeric(since_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " > cast(" + since_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + since_id + "' ";
}
limit = null;
}
try {
@ -636,12 +662,25 @@ public class StatusCache {
String selection = Sqlite.COL_INSTANCE + "='" + instance + "' AND " + Sqlite.COL_USER_ID + "= '" + user_id + "' AND " + Sqlite.COL_SLUG + "= '" + slug + "' ";
String limit = String.valueOf(MastodonHelper.statusesPerCall(context));
if (min_id != null) {
if (Helper.isNumeric(min_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " > cast(" + min_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + min_id + "' ";
}
order = " ASC";
} else if (max_id != null) {
if (Helper.isNumeric(max_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " < cast(" + max_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " < '" + max_id + "' ";
}
} else if (since_id != null) {
if (Helper.isNumeric(since_id)) {
selection += "AND " + Sqlite.COL_STATUS_ID + " > cast(" + since_id + " as int) ";
} else {
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + since_id + "' ";
}
limit = null;
}
try {

@ -2072,4 +2072,13 @@ public class Helper {
public interface OnFileCopied {
void onFileCopied(File file);
}
public static boolean isNumeric(String str) {
try {
Double.parseDouble(str);
return true;
} catch (NumberFormatException e) {
return false;
}
}
}

Loading…
Cancel
Save