Skip to content

Commit

Permalink
fix(talk_app): Also show reference previews for references with no pr…
Browse files Browse the repository at this point in the history
…oper preview

Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Oct 31, 2024
1 parent 05c8060 commit 33d8b7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,10 @@ class _TalkCommentMessageState extends State<TalkCommentMessage> {
if (parent != null) parent,
text,
for (final entry in references.entries.take(3))
if (entry.value.data?.openGraphObject.name != entry.key)
TalkReferencePreview(
url: entry.key,
openGraphObject: entry.value.data?.openGraphObject,
),
TalkReferencePreview(
url: entry.key,
openGraphObject: entry.value.data?.openGraphObject,
),
if (!widget.isParent && widget.chatMessage.reactions.isNotEmpty)
TalkReactions(
chatMessage: widget.chatMessage,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ void main() {

await tester.pumpAndSettle();

expect(find.byType(TalkReferencePreview), findsExactly(2));
expect(find.byType(TalkReferencePreview), findsExactly(3));
for (final url in ['a', 'b']) {
expect(
find.byWidgetPredicate(
Expand All @@ -735,6 +735,13 @@ void main() {
findsOne,
);
}
expect(
find.byWidgetPredicate(
(widget) =>
widget is TalkReferencePreview && widget.url == 'c' && widget.openGraphObject == brokenOpenGraphObject,
),
findsOne,
);

await expectLater(
find.byType(TalkCommentMessage).first,
Expand Down

0 comments on commit 33d8b7a

Please sign in to comment.