Remove message image from go code
This commit is contained in:
parent
146e6d342c
commit
606ccb6c14
@ -36,7 +36,6 @@ func createTable(db *sql.DB) {
|
||||
"id" string NOT NULL PRIMARY KEY,
|
||||
"author" TEXT,
|
||||
"body" TEXT,
|
||||
"image" TEXT,
|
||||
"messageType" TEXT,
|
||||
"visible" INTEGER,
|
||||
"timestamp" DATE
|
||||
@ -51,11 +50,11 @@ func createTable(db *sql.DB) {
|
||||
|
||||
func addMessage(message models.ChatMessage) {
|
||||
tx, err := _db.Begin()
|
||||
stmt, err := tx.Prepare("INSERT INTO messages(id, author, body, image, messageType, visible, timestamp) values(?, ?, ?, ?, ?, ?, ?)")
|
||||
stmt, err := tx.Prepare("INSERT INTO messages(id, author, body, messageType, visible, timestamp) values(?, ?, ?, ?, ?, ?)")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
_, err = stmt.Exec(message.ID, message.Author, message.Body, message.Image, message.MessageType, 1, message.Timestamp)
|
||||
_, err = stmt.Exec(message.ID, message.Author, message.Body, message.MessageType, 1, message.Timestamp)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -78,12 +77,11 @@ func getChatHistory() []models.ChatMessage {
|
||||
var id string
|
||||
var author string
|
||||
var body string
|
||||
var image string
|
||||
var messageType string
|
||||
var visible int
|
||||
var timestamp time.Time
|
||||
|
||||
err = rows.Scan(&id, &author, &body, &image, &messageType, &visible, ×tamp)
|
||||
err = rows.Scan(&id, &author, &body, &messageType, &visible, ×tamp)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -92,7 +90,6 @@ func getChatHistory() []models.ChatMessage {
|
||||
message.ID = id
|
||||
message.Author = author
|
||||
message.Body = body
|
||||
message.Image = image
|
||||
message.MessageType = messageType
|
||||
message.Visible = visible == 1
|
||||
message.Timestamp = timestamp
|
||||
|
@ -140,7 +140,7 @@ func (s *server) sendWelcomeMessageToClient(c *Client) {
|
||||
time.Sleep(7 * time.Second)
|
||||
|
||||
initialChatMessageText := fmt.Sprintf("Welcome to %s! %s", config.Config.InstanceDetails.Title, config.Config.InstanceDetails.Summary)
|
||||
initialMessage := models.ChatMessage{"owncast-server", config.Config.InstanceDetails.Name, initialChatMessageText, config.Config.InstanceDetails.Logo.Small, "initial-message-1", "CHAT", true, time.Now()}
|
||||
initialMessage := models.ChatMessage{"owncast-server", config.Config.InstanceDetails.Name, initialChatMessageText, "initial-message-1", "CHAT", true, time.Now()}
|
||||
c.Write(initialMessage)
|
||||
}()
|
||||
|
||||
|
@ -18,7 +18,6 @@ type ChatMessage struct {
|
||||
|
||||
Author string `json:"author"`
|
||||
Body string `json:"body"`
|
||||
Image string `json:"image"`
|
||||
ID string `json:"id"`
|
||||
MessageType string `json:"type"`
|
||||
Visible bool `json:"visible"`
|
||||
|
@ -307,9 +307,6 @@ paths:
|
||||
body:
|
||||
type: string
|
||||
description: Escaped HTML of the chat message content.
|
||||
image:
|
||||
type: string
|
||||
description: URL of the chat user avatar.
|
||||
id:
|
||||
type: string
|
||||
description: Unique ID of the chat message.
|
||||
|
Loading…
Reference in New Issue
Block a user