Use HasCreator and HasEditor mixins
This commit is contained in:
parent
48b26f090c
commit
33636dad8e
@ -1,7 +1,7 @@
|
|||||||
component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
||||||
.post.mountable(id=strings.ToLower(post.Type()) + "-" + toString(post.ID()), data-highlight=post.Author().ID == highlightAuthorID, data-pro=post.Author().IsPro(), data-api="/api/" + strings.ToLower(post.Type()) + "/" + post.ID())
|
.post.mountable(id=strings.ToLower(post.Type()) + "-" + toString(post.ID()), data-highlight=post.Creator().ID == highlightAuthorID, data-pro=post.Creator().IsPro(), data-api="/api/" + strings.ToLower(post.Type()) + "/" + post.ID())
|
||||||
.post-author
|
.post-author
|
||||||
Avatar(post.Author())
|
Avatar(post.Creator())
|
||||||
|
|
||||||
//- if post.recipient && post.recipient.ID !== post.author.ID
|
//- if post.recipient && post.recipient.ID !== post.author.ID
|
||||||
//- a.user.post-recipient(href="/+" + post.recipient.nick, title=post.recipient.nick)
|
//- a.user.post-recipient(href="/+" + post.recipient.nick, title=post.recipient.nick)
|
||||||
@ -9,7 +9,7 @@ component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
|||||||
.post-content
|
.post-content
|
||||||
div(id="render-" + post.ID())!= post.HTML()
|
div(id="render-" + post.ID())!= post.HTML()
|
||||||
|
|
||||||
if user != nil && user.ID == post.Author().ID
|
if user != nil && user.ID == post.Creator().ID
|
||||||
.post-edit-interface
|
.post-edit-interface
|
||||||
if post.Type() == "Thread"
|
if post.Type() == "Thread"
|
||||||
input.post-title-input.hidden(id="title-" + post.ID(), value=post.Title(), type="text", placeholder="Thread title")
|
input.post-title-input.hidden(id="title-" + post.ID(), value=post.Title(), type="text", placeholder="Thread title")
|
||||||
@ -30,7 +30,7 @@ component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
|||||||
.post-likes(id="likes-" + post.ID(), title="Likes")= len(post.Likes())
|
.post-likes(id="likes-" + post.ID(), title="Likes")= len(post.Likes())
|
||||||
|
|
||||||
if user != nil
|
if user != nil
|
||||||
if user.ID != post.Author().ID
|
if user.ID != post.Creator().ID
|
||||||
if post.LikedBy(user.ID)
|
if post.LikedBy(user.ID)
|
||||||
a.post-tool.post-unlike.action(id="unlike-" + post.ID(), title="Unlike", data-action="unlike", data-trigger="click")
|
a.post-tool.post-unlike.action(id="unlike-" + post.ID(), title="Unlike", data-action="unlike", data-trigger="click")
|
||||||
Icon("thumbs-down")
|
Icon("thumbs-down")
|
||||||
@ -38,7 +38,7 @@ component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
|||||||
a.post-tool.post-like.action(id="like-" + post.ID(), title="Like", data-action="like", data-trigger="click")
|
a.post-tool.post-like.action(id="like-" + post.ID(), title="Like", data-action="like", data-trigger="click")
|
||||||
Icon("thumbs-up")
|
Icon("thumbs-up")
|
||||||
|
|
||||||
if user.ID == post.Author().ID
|
if user.ID == post.Creator().ID
|
||||||
a.post-tool.post-edit.action(data-action="editPost", data-trigger="click", data-id=post.ID(), title="Edit")
|
a.post-tool.post-edit.action(data-action="editPost", data-trigger="click", data-id=post.ID(), title="Edit")
|
||||||
Icon("pencil")
|
Icon("pencil")
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
component ThreadLink(thread *arn.Thread)
|
component ThreadLink(thread *arn.Thread)
|
||||||
.thread-link.mountable(data-sticky=thread.Sticky)
|
.thread-link.mountable(data-sticky=thread.Sticky)
|
||||||
.post-author.thread-author
|
.post-author.thread-author
|
||||||
Avatar(thread.Author())
|
Avatar(thread.Creator())
|
||||||
.thread-content-container
|
.thread-content-container
|
||||||
.thread-content
|
.thread-content
|
||||||
if thread.Sticky != 0
|
if thread.Sticky != 0
|
||||||
|
@ -8,7 +8,7 @@ component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.Us
|
|||||||
ProfileForumTabs(viewUser)
|
ProfileForumTabs(viewUser)
|
||||||
|
|
||||||
if len(postables) > 0
|
if len(postables) > 0
|
||||||
h1.page-title= len(postables), " latest posts by ", postables[0].Author().Nick
|
h1.page-title= len(postables), " latest posts by ", postables[0].Creator().Nick
|
||||||
PostableList(postables, user)
|
PostableList(postables, user)
|
||||||
else
|
else
|
||||||
p.no-data.mountable= viewUser.Nick + " hasn't written any posts yet."
|
p.no-data.mountable= viewUser.Nick + " hasn't written any posts yet."
|
@ -16,7 +16,7 @@ component QuoteMainColumn(quote *arn.Quote, user *arn.User)
|
|||||||
span Edited
|
span Edited
|
||||||
span.utc-date(data-date=quote.Edited)
|
span.utc-date(data-date=quote.Edited)
|
||||||
span by
|
span by
|
||||||
a(href=quote.EditedByUser().Link())= quote.EditedByUser().Nick
|
a(href=quote.Editor().Link())= quote.Editor().Nick
|
||||||
else
|
else
|
||||||
span Posted
|
span Posted
|
||||||
span.utc-date(data-date=quote.Created)
|
span.utc-date(data-date=quote.Created)
|
||||||
|
@ -85,16 +85,16 @@ component ForumSearchResults(posts []*arn.Post, threads []*arn.Thread)
|
|||||||
.forum-search-result.mountable(data-mountable-type="forum")
|
.forum-search-result.mountable(data-mountable-type="forum")
|
||||||
.forum-search-result-header
|
.forum-search-result-header
|
||||||
a.forum-search-result-title(href=thread.Link())= thread.Title
|
a.forum-search-result-title(href=thread.Link())= thread.Title
|
||||||
if thread.Author().HasNick()
|
if thread.Creator().HasNick()
|
||||||
.forum-search-result-author= thread.Author().Nick
|
.forum-search-result-author= thread.Creator().Nick
|
||||||
.forum-search-result-sample= thread.Text
|
.forum-search-result-sample= thread.Text
|
||||||
|
|
||||||
each post in posts
|
each post in posts
|
||||||
.forum-search-result.mountable(data-mountable-type="forum")
|
.forum-search-result.mountable(data-mountable-type="forum")
|
||||||
.forum-search-result-header
|
.forum-search-result-header
|
||||||
a.forum-search-result-title(href=post.Link(), data-mountable-type="forum")= post.Thread().Title
|
a.forum-search-result-title(href=post.Link(), data-mountable-type="forum")= post.Thread().Title
|
||||||
if post.Author().HasNick()
|
if post.Creator().HasNick()
|
||||||
.forum-search-result-author= post.Author().Nick
|
.forum-search-result-author= post.Creator().Nick
|
||||||
.forum-search-result-sample= post.Text
|
.forum-search-result-sample= post.Text
|
||||||
|
|
||||||
component SoundTrackSearchResults(tracks []*arn.SoundTrack)
|
component SoundTrackSearchResults(tracks []*arn.SoundTrack)
|
||||||
|
@ -61,7 +61,7 @@ component SoundTrackPage(track *arn.SoundTrack, user *arn.User)
|
|||||||
span Edited
|
span Edited
|
||||||
span.utc-date(data-date=track.Edited)
|
span.utc-date(data-date=track.Edited)
|
||||||
span by
|
span by
|
||||||
span= track.EditedByUser().Nick
|
span= track.Editor().Nick
|
||||||
else
|
else
|
||||||
span Posted
|
span Posted
|
||||||
span.utc-date(data-date=track.Created)
|
span.utc-date(data-date=track.Created)
|
||||||
|
@ -3,10 +3,10 @@ component Thread(thread *arn.Thread, posts []*arn.Post, user *arn.User)
|
|||||||
|
|
||||||
#thread.thread(data-id=thread.ID)
|
#thread.thread(data-id=thread.ID)
|
||||||
.posts
|
.posts
|
||||||
Postable(thread.ToPostable(), user, thread.Author().ID)
|
Postable(thread.ToPostable(), user, thread.Creator().ID)
|
||||||
|
|
||||||
each post in posts
|
each post in posts
|
||||||
Postable(post.ToPostable(), user, thread.Author().ID)
|
Postable(post.ToPostable(), user, thread.Creator().ID)
|
||||||
|
|
||||||
// Reply
|
// Reply
|
||||||
if user != nil
|
if user != nil
|
||||||
|
17
patches/add-forum-creators/add-forum-creators.go
Normal file
17
patches/add-forum-creators/add-forum-creators.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "github.com/animenotifier/arn"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
defer arn.Node.Close()
|
||||||
|
|
||||||
|
for post := range arn.StreamPosts() {
|
||||||
|
post.CreatedBy = post.AuthorID
|
||||||
|
post.Save()
|
||||||
|
}
|
||||||
|
|
||||||
|
for thread := range arn.StreamThreads() {
|
||||||
|
thread.CreatedBy = thread.AuthorID
|
||||||
|
thread.Save()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user