Added forum post editing
This commit is contained in:
@ -6,16 +6,18 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Get post.
|
||||
func Get(ctx *aero.Context) string {
|
||||
id := ctx.Get("id")
|
||||
user := utils.GetUser(ctx)
|
||||
post, err := arn.GetPost(id)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusNotFound, "Post not found", err)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Post(post))
|
||||
return ctx.HTML(components.Post(post, user))
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
component Post(post *arn.Post)
|
||||
Postable(post.ToPostable(), "")
|
||||
component Post(post *arn.Post, user *arn.User)
|
||||
Postable(post.ToPostable(), user, "")
|
||||
|
||||
.side-note
|
||||
a.ajax(href=post.Thread().Link())= post.Thread().Title
|
||||
|
@ -3,6 +3,6 @@ component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.Us
|
||||
|
||||
if len(postables) > 0
|
||||
h2.page-title= len(postables), " latest posts by ", postables[0].Author().Nick
|
||||
PostableList(postables)
|
||||
PostableList(postables, user)
|
||||
else
|
||||
p.no-data.mountable= viewUser.Nick + " hasn't written any posts yet."
|
@ -3,10 +3,10 @@ component Thread(thread *arn.Thread, posts []*arn.Post, user *arn.User)
|
||||
|
||||
#thread.thread(data-id=thread.ID)
|
||||
.posts
|
||||
Postable(thread.ToPostable(), thread.Author().ID)
|
||||
Postable(thread.ToPostable(), user, thread.Author().ID)
|
||||
|
||||
each post in posts
|
||||
Postable(post.ToPostable(), thread.Author().ID)
|
||||
Postable(post.ToPostable(), user, thread.Author().ID)
|
||||
|
||||
// Reply
|
||||
if user != nil
|
||||
|
Reference in New Issue
Block a user