Simplify thread annotation message ID format
This commit is contained in:
parent
e4703c73d6
commit
ddc2fc1818
2 changed files with 3 additions and 7 deletions
|
|
@ -927,14 +927,10 @@ func messageThreadAnnotationBody(msg providers.Message) string {
|
||||||
formattedIDs = "#" + formattedIDs
|
formattedIDs = "#" + formattedIDs
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
case len(msgIDs) > 1 && msg.ReplyToMessageID != "":
|
case len(msgIDs) > 0 && msg.ReplyToMessageID != "":
|
||||||
return fmt.Sprintf("msgs:%s, reply_to:#%s", formattedIDs, msg.ReplyToMessageID)
|
return fmt.Sprintf("msgs:%s, reply_to:#%s", formattedIDs, msg.ReplyToMessageID)
|
||||||
case len(msgIDs) > 1:
|
case len(msgIDs) > 0:
|
||||||
return fmt.Sprintf("msgs:%s", formattedIDs)
|
return fmt.Sprintf("msgs:%s", formattedIDs)
|
||||||
case len(msgIDs) == 1 && msg.ReplyToMessageID != "":
|
|
||||||
return fmt.Sprintf("msg:%s, reply_to:#%s", formattedIDs, msg.ReplyToMessageID)
|
|
||||||
case len(msgIDs) == 1:
|
|
||||||
return fmt.Sprintf("msg:%s", formattedIDs)
|
|
||||||
case msg.ReplyToMessageID != "":
|
case msg.ReplyToMessageID != "":
|
||||||
return fmt.Sprintf("reply_to:#%s", msg.ReplyToMessageID)
|
return fmt.Sprintf("reply_to:#%s", msg.ReplyToMessageID)
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ func TestMessageHistoryAnnotation_IncludesSenderAndThreading(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if got := messageHistoryAnnotation(msg); got != "[from:Alice Example (@alice), msg:#m1, reply_to:#p0] " {
|
if got := messageHistoryAnnotation(msg); got != "[from:Alice Example (@alice), msgs:#m1, reply_to:#p0] " {
|
||||||
t.Fatalf("messageHistoryAnnotation() = %q", got)
|
t.Fatalf("messageHistoryAnnotation() = %q", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue