tangled
alpha
login
or
join now
stream.place
/
streamplace
74
fork
atom
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
fix: truncate chat messages to 300 chars
ElshadHu
2 months ago
3a63fc3a
910f4e01
+8
1 changed file
expand all
collapse all
unified
split
pkg
model
chat_message.go
+8
pkg/model/chat_message.go
···
41
41
if err != nil {
42
42
return nil, fmt.Errorf("error decoding feed post: %w", err)
43
43
}
44
44
+
// Truncate message text if it is a ChatMessage
45
45
+
if msg, ok := rec.(*streamplace.ChatMessage); ok {
46
46
+
runes := []rune(msg.Text)
47
47
+
if len(runes) > 300 {
48
48
+
msg.Text = string(runes[:300])
49
49
+
}
50
50
+
}
51
51
+
44
52
message := &streamplace.ChatDefs_MessageView{
45
53
LexiconTypeID: "place.stream.chat.defs#messageView",
46
54
}