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
This commit is contained in:
Florian Müllner 2020-03-22 21:14:34 +01:00
parent ffb8bd5fa7
commit 61beccf733

View File

@ -115,7 +115,7 @@ var NotificationsBox = GObject.registerClass({
box.add_child(textBox); box.add_child(textBox);
let title = new St.Label({ let title = new St.Label({
text: source.title, text: source.title.replace(/\n/g, ' '),
style_class: 'unlock-dialog-notification-label', style_class: 'unlock-dialog-notification-label',
}); });
textBox.add(title); textBox.add(title);
@ -129,9 +129,10 @@ var NotificationsBox = GObject.registerClass({
let body = ''; let body = '';
if (n.bannerBodyText) { if (n.bannerBodyText) {
const bodyText = n.bannerBodyText.replace(/\n/g, ' ');
body = n.bannerBodyMarkup body = n.bannerBodyMarkup
? n.bannerBodyText ? bodyText
: GLib.markup_escape_text(n.bannerBodyText, -1); : GLib.markup_escape_text(bodyText, -1);
} }
let label = new St.Label({ style_class: 'unlock-dialog-notification-count-text' }); let label = new St.Label({ style_class: 'unlock-dialog-notification-count-text' });