mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 19:38:22 +01:00
Fix is_submitter property not being present on responses from the reveddit API. (#1335)
Try to fix pushshift API deleted comment searching.
This commit is contained in:
parent
116be7ecc2
commit
b0f77528e1
@ -54,8 +54,8 @@ public class FetchRemovedComment {
|
|||||||
try {
|
try {
|
||||||
Response<String> response = retrofit.create(PushshiftAPI.class).searchComments(
|
Response<String> response = retrofit.create(PushshiftAPI.class).searchComments(
|
||||||
comment.getLinkId(),
|
comment.getLinkId(),
|
||||||
3000,
|
1000,
|
||||||
"asc",
|
"id",
|
||||||
"id,author,body,is_submitter",
|
"id,author,body,is_submitter",
|
||||||
after,
|
after,
|
||||||
after + 43200, // 12 Hours later
|
after + 43200, // 12 Hours later
|
||||||
|
@ -55,13 +55,15 @@ public class FetchRemovedCommentReveddit {
|
|||||||
String id = result.getString(JSONUtils.ID_KEY);
|
String id = result.getString(JSONUtils.ID_KEY);
|
||||||
String author = result.getString(JSONUtils.AUTHOR_KEY);
|
String author = result.getString(JSONUtils.AUTHOR_KEY);
|
||||||
String body = Utils.modifyMarkdown(Utils.trimTrailingWhitespace(result.optString(JSONUtils.BODY_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()))) {
|
if (id.equals(comment.getId()) && (!author.equals(comment.getAuthor()) || !body.equals(comment.getCommentRawText()))) {
|
||||||
comment.setAuthor(author);
|
comment.setAuthor(author);
|
||||||
comment.setCommentMarkdown(body);
|
comment.setCommentMarkdown(body);
|
||||||
comment.setCommentRawText(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;
|
return comment;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1811,7 +1811,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
|
|
||||||
public void showRemovedComment(Comment comment, int position) {
|
public void showRemovedComment(Comment comment, int position) {
|
||||||
Toast.makeText(activity, R.string.fetching_removed_comment, Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, R.string.fetching_removed_comment, Toast.LENGTH_SHORT).show();
|
||||||
FetchRemovedComment.searchRemovedComment(
|
FetchRemovedComment.fetchRemovedComment(
|
||||||
mExecutor, new Handler(), pushshiftRetrofit, comment,
|
mExecutor, new Handler(), pushshiftRetrofit, comment,
|
||||||
new FetchRemovedComment.FetchRemovedCommentListener() {
|
new FetchRemovedComment.FetchRemovedCommentListener() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user