MM-23926: avoid setting last viewed for bots (#14253)
The current code path for `CreatePostAsUser` tries to update the `LastViewedAt` for bots, which logs a warning message if the bot isn't actually in the channel. This pull request changes the semantics of bot posting to not update the bot's `LastViewedAt` timestamp, avoiding this log altogether. It matches the semantics of `from_webhook`, but notably makes bots slightly less like users in that they no longer "read" channels when they post. This seems reasonable, but I'm both looking for validation of this semantic change in addition to the code review. Fixes: https://mattermost.atlassian.net/browse/MM-23926 Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d0dea3b19a
Коммит
636d168b84
@@ -31,3 +31,24 @@ func AssertLog(t *testing.T, logs *bytes.Buffer, level, message string) {
|
||||
|
||||
t.Fatalf("failed to find %s log message: %s", level, message)
|
||||
}
|
||||
|
||||
// AssertNoLog asserts that a JSON-encoded buffer of logs does not contains one with the given level and message.
|
||||
func AssertNoLog(t *testing.T, logs *bytes.Buffer, level, message string) {
|
||||
dec := json.NewDecoder(logs)
|
||||
for {
|
||||
var log struct {
|
||||
Level string
|
||||
Msg string
|
||||
}
|
||||
if err := dec.Decode(&log); err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if log.Level == level && log.Msg == message {
|
||||
t.Fatalf("found %s log message: %s", level, message)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user