Skip to content

Commit

Permalink
Merge pull request #2497 from nextcloud/fix/talk_app/message-preview-…
Browse files Browse the repository at this point in the history
…text-overflow
  • Loading branch information
provokateurin authored Sep 14, 2024
2 parents b62f43f + 2abdd80 commit 7f81cfe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,34 +161,36 @@ InlineSpan buildRichObjectParameter({
required TextStyle? textStyle,
required bool isPreview,
}) {
if (isPreview) {
return TextSpan(
text: parameter.name,
style: textStyle,
);
}

return WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: isPreview
? Text(
parameter.name,
style: textStyle,
)
: switch (parameter.type) {
spreed.RichObjectParameter_Type.user ||
spreed.RichObjectParameter_Type.call ||
spreed.RichObjectParameter_Type.guest ||
spreed.RichObjectParameter_Type.userGroup =>
TalkRichObjectMention(
parameter: parameter,
textStyle: textStyle,
),
spreed.RichObjectParameter_Type.file => TalkRichObjectFile(
parameter: parameter,
textStyle: textStyle,
),
spreed.RichObjectParameter_Type.deckCard => TalkRichObjectDeckCard(
parameter: parameter,
),
_ => TalkRichObjectFallback(
parameter: parameter,
textStyle: textStyle,
),
},
child: switch (parameter.type) {
spreed.RichObjectParameter_Type.user ||
spreed.RichObjectParameter_Type.call ||
spreed.RichObjectParameter_Type.guest ||
spreed.RichObjectParameter_Type.userGroup =>
TalkRichObjectMention(
parameter: parameter,
textStyle: textStyle,
),
spreed.RichObjectParameter_Type.file => TalkRichObjectFile(
parameter: parameter,
textStyle: textStyle,
),
spreed.RichObjectParameter_Type.deckCard => TalkRichObjectDeckCard(
parameter: parameter,
),
_ => TalkRichObjectFallback(
parameter: parameter,
textStyle: textStyle,
),
},
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ void main() {
);

expect(find.byType(TalkRichObjectMention), isPreview ? findsNothing : findsOne);
expect(find.text('name'), findsOne);
expect(find.text('name', findRichText: true), findsOne);
});
}
});
Expand Down Expand Up @@ -1587,7 +1587,7 @@ void main() {
);

expect(find.byType(TalkRichObjectFile), isPreview ? findsNothing : findsOne);
expect(find.text('name'), findsOne);
expect(find.text('name', findRichText: true), findsOne);
});

testWidgets('Deck card', (tester) async {
Expand All @@ -1611,7 +1611,7 @@ void main() {
);

expect(find.byType(TalkRichObjectDeckCard), isPreview ? findsNothing : findsOne);
expect(find.text('name'), findsOne);
expect(find.text('name', findRichText: true), findsOne);
});

testWidgets('Fallback', (tester) async {
Expand All @@ -1633,7 +1633,7 @@ void main() {
);

expect(find.byType(TalkRichObjectFallback), isPreview ? findsNothing : findsOne);
expect(find.text('name'), findsOne);
expect(find.text('name', findRichText: true), findsOne);
});
});
}
Expand Down

0 comments on commit 7f81cfe

Please sign in to comment.