add 'nothreads' option, fixes #4
This commit is contained in:
@@ -112,7 +112,7 @@ func (b *Bot) Send(ctx context.Context, email *utils.Email) error {
|
|||||||
contentParsed := format.RenderMarkdown(text.String(), true, true)
|
contentParsed := format.RenderMarkdown(text.String(), true, true)
|
||||||
|
|
||||||
var threadID id.EventID
|
var threadID id.EventID
|
||||||
if email.InReplyTo != "" {
|
if email.InReplyTo != "" && !settings.NoThreads() {
|
||||||
threadID = b.getThreadID(roomID, email.InReplyTo)
|
threadID = b.getThreadID(roomID, email.InReplyTo)
|
||||||
if threadID != "" {
|
if threadID != "" {
|
||||||
contentParsed.SetRelatesTo(&event.RelatesTo{
|
contentParsed.SetRelatesTo(&event.RelatesTo{
|
||||||
|
|||||||
@@ -71,6 +71,13 @@ var (
|
|||||||
optionNoHTML,
|
optionNoHTML,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: optionNoThreads,
|
||||||
|
description: fmt.Sprintf(
|
||||||
|
"Get or set `%s` of the room (`true` - ignore email threads; `false` - convert email threads into matrix threads)",
|
||||||
|
optionNoThreads,
|
||||||
|
),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanitizers is map of option name => sanitizer function
|
// sanitizers is map of option name => sanitizer function
|
||||||
@@ -79,6 +86,7 @@ var (
|
|||||||
optionNoSender: utils.SanitizeBoolString,
|
optionNoSender: utils.SanitizeBoolString,
|
||||||
optionNoSubject: utils.SanitizeBoolString,
|
optionNoSubject: utils.SanitizeBoolString,
|
||||||
optionNoHTML: utils.SanitizeBoolString,
|
optionNoHTML: utils.SanitizeBoolString,
|
||||||
|
optionNoThreads: utils.SanitizeBoolString,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const (
|
|||||||
optionNoSender = "nosender"
|
optionNoSender = "nosender"
|
||||||
optionNoSubject = "nosubject"
|
optionNoSubject = "nosubject"
|
||||||
optionNoHTML = "nohtml"
|
optionNoHTML = "nohtml"
|
||||||
|
optionNoThreads = "nothreads"
|
||||||
)
|
)
|
||||||
|
|
||||||
var migrations = []string{}
|
var migrations = []string{}
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ func (s settings) NoHTML() bool {
|
|||||||
return utils.Bool(s.Get(optionNoHTML))
|
return utils.Bool(s.Get(optionNoHTML))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s settings) NoThreads() bool {
|
||||||
|
return utils.Bool(s.Get(optionNoThreads))
|
||||||
|
}
|
||||||
|
|
||||||
// Set option
|
// Set option
|
||||||
func (s settings) Set(key, value string) {
|
func (s settings) Set(key, value string) {
|
||||||
s[strings.ToLower(strings.TrimSpace(key))] = value
|
s[strings.ToLower(strings.TrimSpace(key))] = value
|
||||||
|
|||||||
Reference in New Issue
Block a user