[gnome-shell] unlockDialog: Handle embedded newlines in notifications



commit 61beccf7334aa0679325af180e3e1e07af034ace
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Mar 22 21:14:34 2020 +0100

    unlockDialog: Handle embedded newlines in notifications
    
    Detailed notifications are meant to be single line, just as unexpanded
    notification banners. So handle them the same way as in the message
    list, and replace embedded newlines by spaces.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/2463

 js/ui/unlockDialog.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 33635fdd03..d27b1d59ca 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -115,7 +115,7 @@ var NotificationsBox = GObject.registerClass({
         box.add_child(textBox);
 
         let title = new St.Label({
-            text: source.title,
+            text: source.title.replace(/\n/g, ' '),
             style_class: 'unlock-dialog-notification-label',
         });
         textBox.add(title);
@@ -129,9 +129,10 @@ var NotificationsBox = GObject.registerClass({
 
             let body = '';
             if (n.bannerBodyText) {
+                const bodyText = n.bannerBodyText.replace(/\n/g, ' ');
                 body = n.bannerBodyMarkup
-                    ? n.bannerBodyText
-                    : GLib.markup_escape_text(n.bannerBodyText, -1);
+                    ? bodyText
+                    : GLib.markup_escape_text(bodyText, -1);
             }
 
             let label = new St.Label({ style_class: 'unlock-dialog-notification-count-text' });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]