diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index d526b81..f08d88a 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -155,7 +155,9 @@ class NotificationService { if (reaction != null) { return 'Reacted ${reaction.emoji}'; } - if (GifHelper.parseGif(trimmed) != null) { + // resolveGifUrl, not parseGif: the tray must summarise exactly the set the + // chat renders inline, or an allowlisted Tenor GIF shows as a raw URL. (#283) + if (GifHelper.resolveGifUrl(trimmed) != null) { return 'Sent a GIF'; } return text; diff --git a/test/services/notification_text_test.dart b/test/services/notification_text_test.dart index 8875798..3da21ad 100644 --- a/test/services/notification_text_test.dart +++ b/test/services/notification_text_test.dart @@ -64,4 +64,33 @@ void main() { ); }); }); + + group('allowlisted media URLs summarise too (#283 consistency)', () { + test('a pasted i.giphy.com link summarises', () { + expect( + NotificationService.formatNotificationText( + 'https://i.giphy.com/$gifId.webp', + ), + 'Sent a GIF', + ); + }); + + test('a pasted Tenor CDN link summarises', () { + expect( + NotificationService.formatNotificationText( + 'https://media.tenor.com/abc123XYZ/happy-dance.gif', + ), + 'Sent a GIF', + ); + }); + + test('an off-allowlist image URL does NOT summarise', () { + expect( + NotificationService.formatNotificationText( + 'https://evil.example.com/tracker.gif', + ), + 'https://evil.example.com/tracker.gif', + ); + }); + }); }