From 54ce8bb08d12d76c6d465c1697557b2ae943df61 Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Fri, 15 Mar 2019 16:30:06 -0400 Subject: [PATCH] chat: Remove injectTimestamp after 30min stuff --- chat/command.go | 2 +- chat/message/user.go | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/chat/command.go b/chat/command.go index d459fc5..cba9bbc 100644 --- a/chat/command.go +++ b/chat/command.go @@ -284,7 +284,7 @@ func InitCommands(c *Commands) { c.Add(Command{ Prefix: "/timestamp", - Help: "Timestamps after 30min of inactivity.", + Help: "Prefix messages with a timestamp.", Handler: func(room *Room, msg message.CommandMsg) error { u := msg.From() cfg := u.Config() diff --git a/chat/message/user.go b/chat/message/user.go index f8cebf4..e825ae1 100644 --- a/chat/message/user.go +++ b/chat/message/user.go @@ -195,20 +195,8 @@ func (u *User) writeMsg(m Message) error { // HandleMsg will render the message to the screen, blocking. func (u *User) HandleMsg(m Message) error { u.mu.Lock() - cfg := u.config - lastMsg := u.lastMsg u.lastMsg = m.Timestamp() - injectTimestamp := !lastMsg.IsZero() && cfg.Timestamp && u.lastMsg.Sub(lastMsg) > timestampTimeout u.mu.Unlock() - - if injectTimestamp { - // Inject a timestamp at most once every timestampTimeout between message intervals - ts := NewSystemMsg(fmt.Sprintf("Timestamp: %s", m.Timestamp().UTC().Format(timestampLayout)), u) - if err := u.writeMsg(ts); err != nil { - return err - } - } - return u.writeMsg(m) }