diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-07-20 11:51:03 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-07-20 11:51:03 -0700 |
| commit | 4d64a5b96d95c2fede033907aa3463068990b8ff (patch) | |
| tree | 3bf721199d1e22567012707576596c9dc1c90293 /hotline | |
| parent | 69098db9396aa35e93b7294fd9465dd98287f305 (diff) | |
Fix bug causing flat news post loss
Diffstat (limited to 'hotline')
| -rw-r--r-- | hotline/transaction_handlers.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go index 2d03b07..56f7afa 100644 --- a/hotline/transaction_handlers.go +++ b/hotline/transaction_handlers.go @@ -1034,14 +1034,14 @@ func HandleTranOldPostNews(cc *ClientConn, t *Transaction) (res []Transaction, e newsPost := fmt.Sprintf(newsTemplate+"\r", cc.UserName, time.Now().Format(newsDateTemplate), t.GetField(fieldData).Data) newsPost = strings.Replace(newsPost, "\n", "\r", -1) + // update news in memory + cc.Server.FlatNews = append([]byte(newsPost), cc.Server.FlatNews...) + // update news on disk if err := cc.Server.FS.WriteFile(filepath.Join(cc.Server.ConfigDir, "MessageBoard.txt"), cc.Server.FlatNews, 0644); err != nil { return res, err } - // update news in memory - cc.Server.FlatNews = append([]byte(newsPost), cc.Server.FlatNews...) - // Notify all clients of updated news cc.sendAll( tranNewMsg, |