@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
26 lines • 788 B
JavaScript
/**
* Reddit-style deletion: instead of removing the comment from the tree,
* mark it as user-deleted by clearing content fields and setting userDeletedAt.
* The comment remains visible as a placeholder so children stay intact.
*/
export function markCommentAsDeletedInTree(state, commentId) {
const entry = state[commentId];
if (!entry)
return state;
return {
...state,
[commentId]: {
...entry,
comment: {
...entry.comment,
userDeletedAt: new Date(),
content: null,
gif: null,
mentions: [],
userId: null,
user: undefined,
},
},
};
}
//# sourceMappingURL=markCommentAsDeletedInTree.js.map