mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-09-01 07:26:23 -07:00
Add banned message handling to posts and update related views
This commit is contained in:
parent
6cfe3d5c3f
commit
401662a0a9
4 changed files with 12 additions and 7 deletions
|
@ -19,7 +19,7 @@ import (
|
|||
|
||||
const (
|
||||
buildingPostsBaseQuery = `SELECT id, thread_id, ip, name, tripcode, is_secure_tripcode, email, subject, created_on,
|
||||
last_modified, parent_id, last_bump, message, message_raw, board_id, dir, original_filename, filename,
|
||||
last_modified, parent_id, last_bump, message, message_raw, banned_message, board_id, dir, original_filename, filename,
|
||||
checksum, filesize, tw, th, width, height, spoiler_file, locked, stickied, cyclical, spoiler_thread, flag, country, is_deleted
|
||||
FROM DBPREFIXv_building_posts `
|
||||
)
|
||||
|
@ -210,8 +210,8 @@ func QueryPosts(query string, params []any, cb func(*Post) error) error {
|
|||
var spoilerFile bool
|
||||
dest = append(dest,
|
||||
&post.Name, &post.Tripcode, &post.IsSecureTripcode, &post.Email, &post.Subject, &post.CreatedOn,
|
||||
&post.LastModified, &post.ParentID, &lastBump, &post.Message, &post.MessageRaw, &post.BoardID,
|
||||
&post.BoardDir, &post.OriginalFilename, &post.Filename, &post.Checksum, &post.Filesize,
|
||||
&post.LastModified, &post.ParentID, &lastBump, &post.Message, &post.MessageRaw, &post.BannedMessage,
|
||||
&post.BoardID, &post.BoardDir, &post.OriginalFilename, &post.Filename, &post.Checksum, &post.Filesize,
|
||||
&post.ThumbnailWidth, &post.ThumbnailHeight, &post.UploadWidth, &post.UploadHeight, &spoilerFile,
|
||||
&post.thread.Locked, &post.thread.Stickied, &post.thread.Cyclical, &post.thread.IsSpoilered,
|
||||
&post.Country.Flag, &post.Country.Name, &post.IsDeleted)
|
||||
|
|
|
@ -217,7 +217,7 @@ type Post struct {
|
|||
Password string `json:"-"` // sql: `password`
|
||||
DeletedAt time.Time `json:"-"` // sql: deleted_at
|
||||
IsDeleted bool `json:"-"` // sql: is_deleted
|
||||
BannedMessage string `json:"-"` // sql: banned_message
|
||||
BannedMessage template.HTML `json:"-"` // sql: banned_message
|
||||
Flag string `json:"-"` // sql: flag
|
||||
Country string `json:"-"` // sql: country
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ SELECT id, thread_id FROM DBPREFIXposts WHERE is_top_post;
|
|||
CREATE VIEW DBPREFIXv_building_posts AS
|
||||
SELECT p.id AS id, p.thread_id AS thread_id, ip, name, tripcode, is_secure_tripcode,
|
||||
email, subject, created_on, created_on as last_modified, op.id AS parent_id, t.last_bump as last_bump,
|
||||
message, message_raw, t.board_id,
|
||||
message, message_raw, COALESCE(banned_message, '') AS banned_message, t.board_id,
|
||||
(SELECT dir FROM DBPREFIXboards WHERE id = t.board_id LIMIT 1) AS dir,
|
||||
COALESCE(f.original_filename, '') as original_filename,
|
||||
COALESCE(f.filename, '') AS filename,
|
||||
|
|
|
@ -57,5 +57,10 @@
|
|||
{{- end -}}
|
||||
{{- if $.post.IsTopPost}}{{template "nameline" .}}{{end -}}
|
||||
<div class="post-text">{{.post.Message}}</div>
|
||||
</div>{{if not $.post.IsTopPost}}
|
||||
{{if not $.post.IsTopPost}}</div>{{end}}{{end}}
|
||||
{{- if ne $.post.BannedMessage "" -}}
|
||||
<div class="banned">
|
||||
{{$.post.BannedMessage}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{if not $.post.IsTopPost}}</div>{{end}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue