Add timestamps to backlogged messages
This commit is contained in:
parent
b453406299
commit
0823b72acc
2 changed files with 6 additions and 1 deletions
|
@ -454,7 +454,7 @@ func (mm *Mattermost) processBacklog(ch *model.Channel, backlog *model.PostList)
|
||||||
post := backlog.Posts[post_id]
|
post := backlog.Posts[post_id]
|
||||||
post_time := time.Unix(post.CreateAt/1000, 0)
|
post_time := time.Unix(post.CreateAt/1000, 0)
|
||||||
post.Message = fmt.Sprintf("[%s] %s",
|
post.Message = fmt.Sprintf("[%s] %s",
|
||||||
post_time.Format("2006-01-02 15:04:05 MST"), post.Message)
|
post_time.Format("2006-01-02 15:04 MST"), post.Message)
|
||||||
mm.handlePost(ch.Name, post, true)
|
mm.handlePost(ch.Name, post, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
external/messenger.py
vendored
5
external/messenger.py
vendored
|
@ -162,6 +162,11 @@ class InitialSyncThread(threading.Thread):
|
||||||
else:
|
else:
|
||||||
messages.append(m)
|
messages.append(m)
|
||||||
for m in reversed(messages):
|
for m in reversed(messages):
|
||||||
|
if m.text is None:
|
||||||
|
m.text = ""
|
||||||
|
m.text = "[{}] {}".format(
|
||||||
|
time.strftime("%Y-%m-%d %H:%M %Z", time.localtime(float(m.timestamp)/1000)).strip(),
|
||||||
|
m.text)
|
||||||
self.bridge.onMessage(thread_id=thread.uid,
|
self.bridge.onMessage(thread_id=thread.uid,
|
||||||
thread_type=thread.type,
|
thread_type=thread.type,
|
||||||
message_object=m)
|
message_object=m)
|
||||||
|
|
Loading…
Reference in a new issue