mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-28 21:10:36 +00:00
fdfeeed6d9
Add some support for comment visibility, fix #217 This add a new column to comment, denoting if they are public or not, and a new table linking private comments to those allowed to read them. There is currently no way to write a private comment from Plume. Git is having a hard time what happened in Comment::from_activity, but most of it is just re-indentation because a new block was needed to please the borrow checker. I've marked with comments where things actually changed. At this point only mentioned users can see private comments, even when posted as "follower only" or equivalent. What should we do when someone isn't allowed to see a comment? Hide the whole thread, or just the comment? If hiding just the comment, should we mark there is a comment one can't see, but answers they can, or put other comments like if they answered to the same comment the hidden one do?
41 lines
1.6 KiB
HTML
41 lines
1.6 KiB
HTML
@use template_utils::*;
|
|
@use plume_models::comments::CommentTree;
|
|
@use routes::*;
|
|
|
|
@(ctx: BaseContext, comment_tree: &CommentTree, in_reply_to: Option<&str>, blog: &str, slug: &str)
|
|
|
|
@if let Some(ref comm) = Some(&comment_tree.comment) {
|
|
@if let Some(author) = Some(comm.get_author(ctx.0)) {
|
|
<div class="comment u-comment h-cite" id="comment-@comm.id">
|
|
<a class="author u-author h-card" href="@uri!(user::details: name = author.get_fqn(ctx.0))">
|
|
@avatar(ctx.0, &author, Size::Small, true, ctx.1)
|
|
<span class="display-name p-name">@author.name(ctx.0)</span>
|
|
<small>@author.get_fqn(ctx.0)</small>
|
|
</a>
|
|
@if let Some(ref ap_url) = comm.ap_url {
|
|
<a class="u-url" href="@ap_url"></a>
|
|
}
|
|
@if let Some(ref in_reply_to) = in_reply_to {
|
|
<a class="u-in-reply-to" href="@in_reply_to"></a>
|
|
}
|
|
<div class="text p-content">
|
|
@if comm.sensitive {
|
|
<details>
|
|
<summary>@comm.spoiler_text</summary>
|
|
}
|
|
@Html(&comm.content)
|
|
@if comm.sensitive {
|
|
</details>
|
|
}
|
|
</div>
|
|
<a class="button icon icon-message-circle" href="?responding_to=@comm.id">@i18n!(ctx.1, "Respond")</a>
|
|
@if ctx.2.clone().map(|u| u.id == author.id).unwrap_or(false) {
|
|
<form class="inline icon icon-trash" method="post" action="@uri!(comments::delete: blog = blog, slug = slug, id = comm.id)">
|
|
<input onclick="return confirm('Are you sure you?')" type="submit" value="@i18n!(ctx.1, "Delete this comment")">
|
|
</form>
|
|
}
|
|
@for res in &comment_tree.responses {
|
|
@:comment(ctx, res, comm.ap_url.as_ref().map(|u| &**u), blog, slug)
|
|
}
|
|
</div>
|
|
}}
|