diff options
author | Andrei Shpakovskiy <50966785+AndreiShpakovskiy@users.noreply.github.com> | 2022-09-21 04:53:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 04:53:19 +0000 |
commit | 3c492d262621c3f69cd03a33b12260f73aeaeba2 (patch) | |
tree | 86ccbf74f472fa60b2dca3205648f610594dd731 /app | |
parent | 9fad6fc9616bc317f88433b136a79f41905134ff (diff) | |
download | infinity-for-reddit-3c492d262621c3f69cd03a33b12260f73aeaeba2.tar infinity-for-reddit-3c492d262621c3f69cd03a33b12260f73aeaeba2.tar.gz infinity-for-reddit-3c492d262621c3f69cd03a33b12260f73aeaeba2.tar.bz2 infinity-for-reddit-3c492d262621c3f69cd03a33b12260f73aeaeba2.tar.lz infinity-for-reddit-3c492d262621c3f69cd03a33b12260f73aeaeba2.tar.xz infinity-for-reddit-3c492d262621c3f69cd03a33b12260f73aeaeba2.tar.zst infinity-for-reddit-3c492d262621c3f69cd03a33b12260f73aeaeba2.zip |
Show OP badge on restored comment (#1016)
Diffstat (limited to '')
4 files changed, 17 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index 2c5deded..5836dacd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -987,8 +987,15 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi } public void editComment(String commentAuthor, String commentContentMarkdown, int position) { - if (commentAuthor != null) + editComment(commentAuthor, mVisibleComments.get(position).isSubmitter(), commentContentMarkdown, position); + } + + public void editComment(String commentAuthor, boolean isSubmitter, String commentContentMarkdown, int position) { + if (commentAuthor != null) { mVisibleComments.get(position).setAuthor(commentAuthor); + } + + mVisibleComments.get(position).setSubmittedByAuthor(isSubmitter); mVisibleComments.get(position).setCommentMarkdown(commentContentMarkdown); if (mIsSingleCommentThreadMode) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java index 2ac6ba70..15b1b68d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java @@ -233,6 +233,10 @@ public class Comment implements Parcelable { return isSubmitter; } + public void setSubmittedByAuthor(boolean isSubmittedByAuthor) { + this.isSubmitter = isSubmittedByAuthor; + } + public boolean isModerator() { return distinguished != null && distinguished.equals("moderator"); } 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 8dc4b84b..39b8e2b5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedComment.java @@ -56,7 +56,7 @@ public class FetchRemovedComment { comment.getLinkId(), 3000, "asc", - "id,author,body", + "id,author,body,is_submitter", after, after + 43200, // 12 Hours later "*").execute(); @@ -107,6 +107,7 @@ public class FetchRemovedComment { String id = result.getString(JSONUtils.ID_KEY); String author = result.getString(JSONUtils.AUTHOR_KEY); String body = Utils.modifyMarkdown(result.optString(JSONUtils.BODY_KEY).trim()); + boolean isSubmitter = result.getBoolean(JSONUtils.IS_SUBMITTER_KEY); if (id.equals(comment.getId()) && (!author.equals(comment.getAuthor()) || @@ -115,6 +116,7 @@ public class FetchRemovedComment { comment.setAuthor(author); comment.setCommentMarkdown(body); comment.setCommentRawText(body); + comment.setSubmittedByAuthor(isSubmitter); return comment; } else { return null; 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 36894561..ab9c9c5a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedCommentReveddit.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/FetchRemovedCommentReveddit.java @@ -55,11 +55,13 @@ public class FetchRemovedCommentReveddit { String id = result.getString(JSONUtils.ID_KEY); String author = result.getString(JSONUtils.AUTHOR_KEY); String body = Utils.modifyMarkdown(result.optString(JSONUtils.BODY_KEY).trim()); + 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); return comment; } else { return null; |