Kaynağa Gözat

Rename parameter in OCP.Toast for consistency with OC.Notification

This fixes HTML messages in "OC.Notification.showTemporary" (as
"showHtml" was not set based on "isHTML"), and also makes OCP.Toast to
keep the old OC.Notification API when used directly.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
tags/v17.0.0beta1
Daniel Calviño Sánchez 5 yıl önce
ebeveyn
işleme
916c95758f
No account linked to committer's email address

+ 1
- 1
core/js/dist/login.js
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
core/js/dist/login.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 2
- 2
core/js/dist/main.js
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
core/js/dist/main.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
core/js/dist/maintenance.js
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
core/js/dist/maintenance.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 11
- 6
core/js/tests/specs/coreSpec.js Dosyayı Görüntüle

@@ -900,10 +900,15 @@ describe('Core base tests', function() {
var hideSpy;
var clock;

var getInnerText = function($node) {
return $node.contents().filter(function(){
return this.nodeType === 3;
})[0].nodeValue;
/**
* Returns the HTML or plain text of the given notification row.
*
* This is needed to ignore the close button that is added to the
* notification row after the text.
*/
var getNotificationText = function($node) {
return $node.contents()[0].outerHTML ||
$node.contents()[0].nodeValue;
}

beforeEach(function() {
@@ -931,7 +936,7 @@ describe('Core base tests', function() {

var $row = $('#testArea .toastify');
expect($row).toBeDefined();
expect(getInnerText($row)).toEqual('My notification test');
expect(getNotificationText($row)).toEqual('My notification test');
});
it('shows a HTML notification with default timeout', function() {
OC.Notification.showTemporary('<a>My notification test</a>', { isHTML: true });
@@ -942,7 +947,7 @@ describe('Core base tests', function() {

var $row = $('#testArea .toastify');
expect($row).toBeDefined();
expect(getInnerText($row)).toEqual('<a>My notification test</a>');
expect(getNotificationText($row)).toEqual('<a>My notification test</a>');
});
it('hides itself after 7 seconds', function() {
OC.Notification.showTemporary('');

+ 1
- 1
core/src/OC/notification.js Dosyayı Görüntüle

@@ -96,7 +96,7 @@ export default {
*/
showHtml: function (html, options) {
options = options || {}
options.showHtml = true
options.isHTML = true
options.timeout = (options.timeout === 0) ? -1 : options.timeout
const toast = window.OCP.Toast.message(html, options)
return $(toast.toastElement)

+ 2
- 2
core/src/OCP/toast.js Dosyayı Görüntüle

@@ -56,12 +56,12 @@ const Toast = {
options = options || {};
_.defaults(options, {
timeout: 7,
showHtml: false,
isHTML: false,
type: undefined,
close: true,
callback: () => {}
});
if (!options.showHtml) {
if (!options.isHTML) {
text = $('<div/>').text(text).html()
}
let classes = ''

Loading…
İptal
Kaydet