markdown support for talk messages
This commit is contained in:
@@ -324,6 +324,22 @@ class DemoTalk {
|
||||
message: 'Gute Idee, ich sammle schon mal Vorschläge.',
|
||||
reactions: {'👍': 3},
|
||||
),
|
||||
_msg(
|
||||
id: base + 4,
|
||||
token: token,
|
||||
actor: 'ben',
|
||||
display: 'Ben',
|
||||
ago: const Duration(hours: 2),
|
||||
message:
|
||||
'## Ablauf Sommerfest\n'
|
||||
'Ein paar **Punkte** für Mittwoch:\n\n'
|
||||
'- Stände aufbauen ab *14 Uhr*\n'
|
||||
'- [x] Getränke bestellt\n'
|
||||
'- [ ] Musik organisieren\n\n'
|
||||
'> Bitte bringt Ideen mit!\n\n'
|
||||
'Mehr Infos auf der [SV-Seite](https://marianum-fulda.de).',
|
||||
markdown: true,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -346,6 +362,7 @@ class DemoTalk {
|
||||
required Duration ago,
|
||||
required String message,
|
||||
Map<String, int>? reactions,
|
||||
bool markdown = false,
|
||||
}) => _msg(
|
||||
id: id,
|
||||
token: token,
|
||||
@@ -354,6 +371,7 @@ class DemoTalk {
|
||||
ago: ago,
|
||||
message: message,
|
||||
reactions: reactions,
|
||||
markdown: markdown,
|
||||
);
|
||||
|
||||
static GetChatResponseObject _msg({
|
||||
@@ -364,6 +382,7 @@ class DemoTalk {
|
||||
required Duration ago,
|
||||
required String message,
|
||||
Map<String, int>? reactions,
|
||||
bool markdown = false,
|
||||
}) => GetChatResponseObject(
|
||||
id,
|
||||
token,
|
||||
@@ -380,6 +399,7 @@ class DemoTalk {
|
||||
reactions,
|
||||
null,
|
||||
null,
|
||||
markdown,
|
||||
);
|
||||
|
||||
static GetRoomResponseObject _room({
|
||||
|
||||
@@ -42,6 +42,11 @@ class GetChatResponseObject {
|
||||
Map<String, RichObjectString>? messageParameters;
|
||||
GetChatResponseObject? parent;
|
||||
|
||||
/// Whether the server flagged this message to be rendered as Markdown
|
||||
/// (capability `markdown-messages`). Absent on older servers/messages, in
|
||||
/// which case it stays `false` and the body renders as plain text.
|
||||
bool markdown;
|
||||
|
||||
GetChatResponseObject(
|
||||
this.id,
|
||||
this.token,
|
||||
@@ -57,8 +62,9 @@ class GetChatResponseObject {
|
||||
this.messageParameters,
|
||||
this.reactions,
|
||||
this.reactionsSelf,
|
||||
this.parent,
|
||||
);
|
||||
this.parent, [
|
||||
this.markdown = false,
|
||||
]);
|
||||
|
||||
factory GetChatResponseObject.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetChatResponseObjectFromJson(json);
|
||||
|
||||
@@ -49,6 +49,7 @@ GetChatResponseObject _$GetChatResponseObjectFromJson(
|
||||
json['parent'] == null
|
||||
? null
|
||||
: GetChatResponseObject.fromJson(json['parent'] as Map<String, dynamic>),
|
||||
json['markdown'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GetChatResponseObjectToJson(
|
||||
@@ -73,6 +74,7 @@ Map<String, dynamic> _$GetChatResponseObjectToJson(
|
||||
(k, e) => MapEntry(k, e.toJson()),
|
||||
),
|
||||
'parent': instance.parent?.toJson(),
|
||||
'markdown': instance.markdown,
|
||||
};
|
||||
|
||||
const _$GetRoomResponseObjectMessageActorTypeEnumMap = {
|
||||
|
||||
Reference in New Issue
Block a user