diff options
author | cmp <camporter1@gmail.com> | 2023-01-21 05:08:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-21 05:08:30 +0000 |
commit | b0f77528e15b00025bdb6f52dd34299604e8e19d (patch) | |
tree | 9a481b150707e16ee43a3a9fd4bf853dea89584f /app/src/main | |
parent | 116be7ecc2f1d36b01f1c5edd7dc6f2032c688ce (diff) | |
download | infinity-for-reddit-b0f77528e15b00025bdb6f52dd34299604e8e19d.tar infinity-for-reddit-b0f77528e15b00025bdb6f52dd34299604e8e19d.tar.gz infinity-for-reddit-b0f77528e15b00025bdb6f52dd34299604e8e19d.tar.bz2 infinity-for-reddit-b0f77528e15b00025bdb6f52dd34299604e8e19d.tar.lz infinity-for-reddit-b0f77528e15b00025bdb6f52dd34299604e8e19d.tar.xz infinity-for-reddit-b0f77528e15b00025bdb6f52dd34299604e8e19d.tar.zst infinity-for-reddit-b0f77528e15b00025bdb6f52dd34299604e8e19d.zip |
Fix is_submitter property not being present on responses from the reveddit API. (#1335)
Try to fix pushshift API deleted comment searching.
Diffstat (limited to 'app/src/main')
3 files changed, 7 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedComment.java index 1c2e3199..24ab8d54 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedComment.java @@ -54,8 +54,8 @@ public class FetchRemovedComment { try { Response<String> response = retrofit.create(PushshiftAPI.class).searchComments( comment.getLinkId(), - 3000, - "asc", + 1000, + "id", "id,author,body,is_submitter", after, after + 43200, // 12 Hours later diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedCommentReveddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedCommentReveddit.java index b7c2e30d..ec7beea8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedCommentReveddit.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedCommentReveddit.java @@ -55,13 +55,15 @@ public class FetchRemovedCommentReveddit { String id = result.getString(JSONUtils.ID_KEY); String author = result.getString(JSONUtils.AUTHOR_KEY); String body = Utils.modifyMarkdown(Utils.trimTrailingWhitespace(result.optString(JSONUtils.BODY_KEY))); - boolean isSubmitter = result.getBoolean(JSONUtils.IS_SUBMITTER_KEY); if (id.equals(comment.getId()) && (!author.equals(comment.getAuthor()) || !body.equals(comment.getCommentRawText()))) { comment.setAuthor(author); comment.setCommentMarkdown(body); comment.setCommentRawText(body); - comment.setSubmittedByAuthor(isSubmitter); + if (result.has(JSONUtils.IS_SUBMITTER_KEY)) { + // This doesn't seem to be present for the Reveddit API anymore... + comment.setSubmittedByAuthor(result.getBoolean(JSONUtils.IS_SUBMITTER_KEY)); + } return comment; } else { return null; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index ee058b57..8ca0d0ea 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -1811,7 +1811,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic public void showRemovedComment(Comment comment, int position) { Toast.makeText(activity, R.string.fetching_removed_comment, Toast.LENGTH_SHORT).show(); - FetchRemovedComment.searchRemovedComment( + FetchRemovedComment.fetchRemovedComment( mExecutor, new Handler(), pushshiftRetrofit, comment, new FetchRemovedComment.FetchRemovedCommentListener() { @Override |