Bug 1714670 - Port bug 1711519 to Thunderbird - Remove gProton use from frontend code. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D116912

--HG--
extra : amend_source : 21e43b155a1974316cb5a0597f62dc5c493c1ab1
This commit is contained in:
Alessandro Castellani 2021-06-05 13:39:48 +03:00
Родитель 2eef875a18
Коммит 4455d8f4dc
4 изменённых файлов: 25 добавлений и 85 удалений

Просмотреть файл

@ -192,13 +192,7 @@ function setupMaxReminders() {
null, null,
gReminderNotification.PRIORITY_WARNING_MEDIUM gReminderNotification.PRIORITY_WARNING_MEDIUM
); );
if (gReminderNotification.gProton) {
notification.closeButton.hidden = true; notification.closeButton.hidden = true;
} else {
let closeButton = notification.messageDetails.nextElementSibling;
closeButton.setAttribute("hidden", "true");
}
} else { } else {
gReminderNotification.removeAllNotifications(); gReminderNotification.removeAllNotifications();
} }

Просмотреть файл

@ -3351,16 +3351,9 @@ var gMessageNotificationBar = {
aCanOverride ? buttons : [] aCanOverride ? buttons : []
); );
// Update the button differently based on the Proton pref.
if (this.msgNotificationBar.gProton) {
notification.buttonContainer.firstElementChild.classList.add( notification.buttonContainer.firstElementChild.classList.add(
"button-menu-list" "button-menu-list"
); );
return;
}
let button = notification.spacer.nextElementSibling;
button.classList.add("button-menu-list");
} }
}, },
@ -3400,16 +3393,9 @@ var gMessageNotificationBar = {
buttons buttons
); );
// Update the button differently based on the Proton pref.
if (this.msgNotificationBar.gProton) {
notification.buttonContainer.firstElementChild.classList.add( notification.buttonContainer.firstElementChild.classList.add(
"button-menu-list" "button-menu-list"
); );
return;
}
let button = notification.spacer.nextElementSibling;
button.classList.add("button-menu-list");
} }
}, },

Просмотреть файл

@ -792,12 +792,7 @@ var gAccountSetup = {
notification.setAttribute("align", "center"); notification.setAttribute("align", "center");
// Hide the close button to prevent dismissing the notification. // Hide the close button to prevent dismissing the notification.
if (this.notificationBox.gProton) {
notification.removeAttribute("dismissable"); notification.removeAttribute("dismissable");
} else {
let closeButton = notification.messageDetails.nextElementSibling;
closeButton.hidden = true;
}
this.ensureVisibleNotification(); this.ensureVisibleNotification();
}, },
@ -839,12 +834,7 @@ var gAccountSetup = {
notification.setAttribute("type", "success"); notification.setAttribute("type", "success");
// Hide the close button to prevent dismissing the notification. // Hide the close button to prevent dismissing the notification.
if (this.notificationBox.gProton) {
notification.removeAttribute("dismissable"); notification.removeAttribute("dismissable");
} else {
let closeButton = notification.messageDetails.nextElementSibling;
closeButton.hidden = true;
}
this.showHelperImage("step3"); this.showHelperImage("step3");
@ -891,12 +881,7 @@ var gAccountSetup = {
); );
// Hide the close button to prevent dismissing the notification. // Hide the close button to prevent dismissing the notification.
if (this.notificationBox.gProton) {
notification.removeAttribute("dismissable"); notification.removeAttribute("dismissable");
} else {
let closeButton = notification.messageDetails.nextElementSibling;
closeButton.hidden = true;
}
this.ensureVisibleNotification(); this.ensureVisibleNotification();
}, },
@ -1900,12 +1885,7 @@ var gAccountSetup = {
); );
// Hide the close button to prevent dismissing the notification. // Hide the close button to prevent dismissing the notification.
if (this.notificationBox.gProton) {
notification.removeAttribute("dismissable"); notification.removeAttribute("dismissable");
} else {
let closeButton = notification.messageDetails.nextElementSibling;
closeButton.hidden = true;
}
} }
}, },

Просмотреть файл

@ -2841,13 +2841,13 @@ function manageAttachmentNotification(aForce = false) {
// specific keywords to the existing notification instead of creating it // specific keywords to the existing notification instead of creating it
// from scratch. // from scratch.
if (notification) { if (notification) {
let selector = this.gComposeNotification.gProton let msgContainer = notification.messageText.querySelector(
? notification.messageText "#attachmentReminderText"
: notification; );
let msgContainer = selector.querySelector("#attachmentReminderText");
msgContainer.setAttribute("value", textValue); msgContainer.setAttribute("value", textValue);
let keywordsContainer = selector.querySelector("#attachmentKeywords"); let keywordsContainer = notification.messageText.querySelector(
"#attachmentKeywords"
);
keywordsContainer.setAttribute("value", keywords); keywordsContainer.setAttribute("value", keywords);
return; return;
} }
@ -2913,19 +2913,10 @@ function manageAttachmentNotification(aForce = false) {
); );
notification.setAttribute("id", "attachmentNotificationBox"); notification.setAttribute("id", "attachmentNotificationBox");
// Variation for Proton UI.
if (this.gComposeNotification.gProton) {
notification.messageText.appendChild(msg); notification.messageText.appendChild(msg);
notification.buttonContainer.lastElementChild.appendChild( notification.buttonContainer.lastElementChild.appendChild(
remindLaterMenuPopup remindLaterMenuPopup
); );
return;
}
notification.messageDetails.querySelector("button").before(msg);
notification.messageDetails
.querySelector("button:last-child")
.appendChild(remindLaterMenuPopup);
} }
/** /**
@ -5148,10 +5139,9 @@ function checkPublicRecipientsLimit() {
// Reuse the existing notification since one is shown already. // Reuse the existing notification since one is shown already.
if (notification) { if (notification) {
let root = this.gComposeNotification.gProton let msgText = notification.messageText.querySelector(
? notification.messageText ".consider-bcc-notification-text"
: notification; );
let msgText = root.querySelector(".consider-bcc-notification-text");
msgText.setAttribute( msgText.setAttribute(
"data-l10n-args", "data-l10n-args",
JSON.stringify({ count: publicAddressPillsCount }) JSON.stringify({ count: publicAddressPillsCount })
@ -5211,17 +5201,7 @@ function checkPublicRecipientsLimit() {
} }
); );
notification.setAttribute("id", "warnPublicRecipientsNotification"); notification.setAttribute("id", "warnPublicRecipientsNotification");
// Variation for Proton UI.
if (this.gComposeNotification.gProton) {
notification.messageText.appendChild(msgText); notification.messageText.appendChild(msgText);
return;
}
// Ugh, the following isn't perfect... but !gProton may be dropped soon.
let msg = document.createElement("div");
msg.appendChild(msgText);
notification.messageDetails.style.display = "flex";
notification.messageDetails.querySelector("button").before(msg);
} }
/** /**