mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 04:37:25 +01:00
Add indication for removed/deleted comments
It is now visible, if a comment is deleted by the creator or if it was removed by a moderator or admin. Closes #249
This commit is contained in:
parent
2c16a05a95
commit
56e05a2e84
@ -443,9 +443,15 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
((CommentBaseViewHolder) holder).bottomConstraintLayout.getLayoutParams().height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
((CommentBaseViewHolder) holder).topScoreTextView.setVisibility(View.GONE);
|
||||
}
|
||||
String text = comment.getCommentMarkdown();
|
||||
if (comment.isRemoved()) {
|
||||
text = "*"+mActivity.getString(R.string.removed_by_moderator)+"*";
|
||||
} else if (comment.isDeleted()) {
|
||||
text = "*"+mActivity.getString(R.string.deleted_by_creator)+"*";
|
||||
}
|
||||
|
||||
|
||||
((CommentBaseViewHolder) holder).mMarkwonAdapter.setMarkdown(mCommentMarkwon, comment.getCommentMarkdown());
|
||||
((CommentBaseViewHolder) holder).mMarkwonAdapter.setMarkdown(mCommentMarkwon,text);
|
||||
// noinspection NotifyDataSetChanged
|
||||
((CommentBaseViewHolder) holder).mMarkwonAdapter.notifyDataSetChanged();
|
||||
if (mHideDownvotes) {
|
||||
|
@ -51,6 +51,7 @@ public class Comment implements Parcelable {
|
||||
private boolean collapsed;
|
||||
|
||||
private boolean isDeleted;
|
||||
private boolean isRemoved;
|
||||
private boolean hasReply;
|
||||
private boolean saved;
|
||||
private boolean isExpanded;
|
||||
@ -69,7 +70,7 @@ public class Comment implements Parcelable {
|
||||
long commentTimeMillis, String commentMarkdown, String commentRawText,
|
||||
String linkId, String communityName, String communityQualifiedName, Integer parentId, int downvotes, int upvotes,
|
||||
int voteType, boolean isSubmitter, String distinguished, String permalink,
|
||||
int depth, boolean collapsed, boolean hasReply, boolean saved, boolean deleted, long edited, String[] path) {
|
||||
int depth, boolean collapsed, boolean hasReply, boolean saved, boolean deleted,boolean removed, long edited, String[] path) {
|
||||
this.id = id;
|
||||
this.postId = postId;
|
||||
this.author = author;
|
||||
@ -92,6 +93,7 @@ public class Comment implements Parcelable {
|
||||
this.hasReply = hasReply;
|
||||
this.saved = saved;
|
||||
this.isDeleted = deleted;
|
||||
this.isRemoved = removed;
|
||||
this.isExpanded = false;
|
||||
this.hasExpandedBefore = false;
|
||||
this.editedTimeMillis = edited;
|
||||
@ -140,6 +142,8 @@ public class Comment implements Parcelable {
|
||||
hasReply = in.readByte() != 0;
|
||||
isExpanded = in.readByte() != 0;
|
||||
hasExpandedBefore = in.readByte() != 0;
|
||||
isDeleted = in.readByte() != 0;
|
||||
isRemoved = in.readByte() != 0;
|
||||
children = new ArrayList<>();
|
||||
in.readTypedList(children, Comment.CREATOR);
|
||||
moreChildrenIds = new ArrayList<>();
|
||||
@ -451,6 +455,8 @@ public class Comment implements Parcelable {
|
||||
parcel.writeByte((byte) (hasReply ? 1 : 0));
|
||||
parcel.writeByte((byte) (isExpanded ? 1 : 0));
|
||||
parcel.writeByte((byte) (hasExpandedBefore ? 1 : 0));
|
||||
parcel.writeByte((byte) (isDeleted ? 1 : 0));
|
||||
parcel.writeByte((byte) (isRemoved ? 1 : 0));
|
||||
parcel.writeTypedList(children);
|
||||
List<String> childrenIds = new ArrayList<>();
|
||||
if (moreChildrenIds != null) {
|
||||
@ -492,4 +498,16 @@ public class Comment implements Parcelable {
|
||||
public BasicUserInfo getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public boolean isRemoved() {
|
||||
return isRemoved;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return isDeleted;
|
||||
}
|
||||
|
||||
public String getDistinguished() {
|
||||
return distinguished;
|
||||
}
|
||||
}
|
||||
|
@ -357,11 +357,12 @@ public class ParseComment {
|
||||
boolean hasReply = countsObj.getInt("child_count") > 0;
|
||||
boolean saved = jsonObject.getBoolean("saved");
|
||||
boolean deleted = commentObj.getBoolean("deleted");
|
||||
boolean removed = commentObj.getBoolean("removed");
|
||||
long edited = 0;
|
||||
BasicUserInfo authorInfo = new BasicUserInfo(creatorObj.getInt("id"), author, authorQualifiedName, creatorObj.optString("avatar", ""), creatorObj.optString("display_name", author));
|
||||
Comment comment = new Comment(id, postID, authorInfo, linkAuthor, commentTimeMillis,
|
||||
commentMarkdown, commentRawText, linkId, communityName, communityQualifiedName, parentId,
|
||||
downvotes, upvotes, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, deleted, edited, path);
|
||||
downvotes, upvotes, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, deleted,removed, edited, path);
|
||||
int child_count = countsObj.getInt("child_count");
|
||||
comment.setChildCount(child_count);
|
||||
comment.setAuthorIconUrl(authorAvatar);
|
||||
|
@ -1332,4 +1332,6 @@
|
||||
<string name="unblock_instance_success">Instance unblocked!</string>
|
||||
<string name="settings_dont_hide_saved_read_posts_automatically">Don\'t hide saved read posts automatically</string>
|
||||
<string name="settings_dont_hide_your_own_read_posts_automatically">Don\'t hide your own read posts automatically</string>
|
||||
<string name="deleted_by_creator">deleted by creator</string>
|
||||
<string name="removed_by_moderator">removed by moderator</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user