parent
68a041711c
commit
1a2cf3b14f
@ -15,7 +15,7 @@ use plume_models::{
|
|||||||
};
|
};
|
||||||
use inbox::Inbox;
|
use inbox::Inbox;
|
||||||
|
|
||||||
#[derive(FromForm)]
|
#[derive(FromForm, Debug)]
|
||||||
struct NewCommentForm {
|
struct NewCommentForm {
|
||||||
pub responding_to: Option<i32>,
|
pub responding_to: Option<i32>,
|
||||||
pub content: String
|
pub content: String
|
||||||
@ -26,6 +26,7 @@ fn create(blog_name: String, slug: String, data: LenientForm<NewCommentForm>, us
|
|||||||
let blog = Blog::find_by_fqn(&*conn, blog_name.clone()).unwrap();
|
let blog = Blog::find_by_fqn(&*conn, blog_name.clone()).unwrap();
|
||||||
let post = Post::find_by_slug(&*conn, slug.clone(), blog.id).unwrap();
|
let post = Post::find_by_slug(&*conn, slug.clone(), blog.id).unwrap();
|
||||||
let form = data.get();
|
let form = data.get();
|
||||||
|
println!("form: {:?}", form);
|
||||||
|
|
||||||
let (new_comment, id) = NewComment::build()
|
let (new_comment, id) = NewComment::build()
|
||||||
.content(form.content.clone())
|
.content(form.content.clone())
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<form method="post" action="/~/{{ blog.actor_id }}/{{ post.slug }}/comment">
|
<form method="post" action="/~/{{ blog.actor_id }}/{{ post.slug }}/comment">
|
||||||
<label for="content">{{ "Your comment" | _ }}</label>
|
<label for="content">{{ "Your comment" | _ }}</label>
|
||||||
{% if previous %}
|
{% if previous %}
|
||||||
<input type="hidden" name="in_response_to" value="{{ previous.id }}"/>
|
<input type="hidden" name="responding_to" value="{{ previous.id }}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# Ugly, but we don't have the choice if we don't want weird paddings #}
|
{# Ugly, but we don't have the choice if we don't want weird paddings #}
|
||||||
<textarea id="content" name="content">{% filter trim %}{% if previous %}{% if previous.author.fqn != user_fqn %}@{{ previous.author.fqn }} {% endif %}{% for mention in previous.mentions %}{% if mention != user_fqn %}@{{ mention }} {% endif %}{% endfor %}{% endif %}{% endfilter %}</textarea>
|
<textarea id="content" name="content">{% filter trim %}{% if previous %}{% if previous.author.fqn != user_fqn %}@{{ previous.author.fqn }} {% endif %}{% for mention in previous.mentions %}{% if mention != user_fqn %}@{{ mention }} {% endif %}{% endfor %}{% endif %}{% endfilter %}</textarea>
|
||||||
|
Loading…
Reference in New Issue
Block a user