Add web templates and handlers for home, embed card, and admin pages
This commit is contained in:
@@ -64,7 +64,6 @@ func (ps *PostService) GetExistingAccountIds() []string {
|
||||
return existingAccountIds
|
||||
}
|
||||
|
||||
|
||||
func (*PostService) GetNewPosts(existingPostIds []string, posts []domain.Post) []domain.Post {
|
||||
var newPosts []domain.Post = nil
|
||||
for _, post := range posts {
|
||||
@@ -108,7 +107,8 @@ func (ps *PostService) GetRandomPost() domain.Post {
|
||||
var post domain.Post
|
||||
ps.db.
|
||||
Preload("Account").
|
||||
Preload("Attachments", "approved = ?", true).
|
||||
Preload("Attachments", "Approved = ?", true).
|
||||
Where("exists (select 1 from media_attachments where post_id = posts.id and approved = ?)", true).
|
||||
Order("RANDOM()").
|
||||
First(&post)
|
||||
if len(post.Attachments) > 0 {
|
||||
@@ -140,7 +140,6 @@ func (ps *PostService) GetMedia() domain.MediaAttachment {
|
||||
return media
|
||||
}
|
||||
|
||||
|
||||
func arrayContains(arr []string, str string) bool {
|
||||
for _, a := range arr {
|
||||
if a == str {
|
||||
|
||||
Reference in New Issue
Block a user