provide proper reply-to fallback by default
This commit is contained in:
29
vendor/gitlab.com/etke.cc/linkpearl/utils.go
generated
vendored
29
vendor/gitlab.com/etke.cc/linkpearl/utils.go
generated
vendored
@@ -7,6 +7,35 @@ import (
|
||||
"maunium.net/go/mautrix/id"
|
||||
)
|
||||
|
||||
// RelatesTo returns relation object of a matrix event (either threads with reply-to fallback or plain reply-to)
|
||||
func RelatesTo(parentID id.EventID, noThreads ...bool) *event.RelatesTo {
|
||||
if parentID == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
var nothreads bool
|
||||
if len(noThreads) > 0 {
|
||||
nothreads = noThreads[0]
|
||||
}
|
||||
|
||||
if nothreads {
|
||||
return &event.RelatesTo{
|
||||
InReplyTo: &event.InReplyTo{
|
||||
EventID: parentID,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return &event.RelatesTo{
|
||||
Type: event.RelThread,
|
||||
EventID: parentID,
|
||||
InReplyTo: &event.InReplyTo{
|
||||
EventID: parentID,
|
||||
},
|
||||
IsFallingBack: true,
|
||||
}
|
||||
}
|
||||
|
||||
// EventParent returns parent event ID (either from thread or from reply-to relation)
|
||||
func EventParent(currentID id.EventID, content *event.MessageEventContent) id.EventID {
|
||||
if content == nil {
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -144,7 +144,7 @@ gitlab.com/etke.cc/go/trysmtp
|
||||
# gitlab.com/etke.cc/go/validator v1.0.6
|
||||
## explicit; go 1.18
|
||||
gitlab.com/etke.cc/go/validator
|
||||
# gitlab.com/etke.cc/linkpearl v0.0.0-20230928051620-7f1b7d54e9a8
|
||||
# gitlab.com/etke.cc/linkpearl v0.0.0-20230928120707-1e99315dc616
|
||||
## explicit; go 1.18
|
||||
gitlab.com/etke.cc/linkpearl
|
||||
# go.mau.fi/util v0.1.0
|
||||
|
||||
Reference in New Issue
Block a user