diff --git a/.eslintrc b/.eslintrc index c44576ad176d..2c9849702331 100644 --- a/.eslintrc +++ b/.eslintrc @@ -122,6 +122,7 @@ "Logger" : false, "Match" : false, "Meteor" : false, + "modal" : false, "moment" : false, "Mongo" : false, "Npm" : false, @@ -139,7 +140,6 @@ "Settings" : false, "SHA256" : false, "SideNav" : false, - "swal" : false, "t" : false, "TAPi18n" : false, "TAPi18next" : false, diff --git a/.meteor/packages b/.meteor/packages index 1d3ecf9f5449..7649bcdc53a8 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -173,7 +173,6 @@ percolate:synced-cron raix:handlebar-helpers raix:push raix:ui-dropped-event -smoral:sweetalert steffo:meteor-accounts-saml todda00:friendly-slugs yasaricli:slugify diff --git a/.meteor/versions b/.meteor/versions index 0100a920c56e..56325d854e47 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -236,7 +236,6 @@ session@1.1.7 sha@1.0.9 shell-server@0.3.1 simple:json-routes@2.1.0 -smoral:sweetalert@1.1.1 spacebars@1.0.15 spacebars-compiler@1.1.3 srp@1.0.10 diff --git a/packages/rocketchat-2fa/client/TOTPPassword.js b/packages/rocketchat-2fa/client/TOTPPassword.js index 2fb6fa0e171e..aacc881d5be9 100644 --- a/packages/rocketchat-2fa/client/TOTPPassword.js +++ b/packages/rocketchat-2fa/client/TOTPPassword.js @@ -45,7 +45,7 @@ Meteor.loginWithPassword = function(email, password, cb) { return cb(error); } - swal({ + modal.open({ title: t('Two-factor_authentication'), text: t('Open_your_authentication_app_and_enter_the_code'), type: 'input', diff --git a/packages/rocketchat-2fa/client/accountSecurity.js b/packages/rocketchat-2fa/client/accountSecurity.js index d60da4e70998..33199f127eea 100644 --- a/packages/rocketchat-2fa/client/accountSecurity.js +++ b/packages/rocketchat-2fa/client/accountSecurity.js @@ -42,7 +42,7 @@ Template.accountSecurity.events({ }, 'click .disable-2fa'() { - swal({ + modal.open({ title: t('Two-factor_authentication'), text: t('Open_your_authentication_app_and_enter_the_code'), type: 'input', @@ -64,7 +64,7 @@ Template.accountSecurity.events({ if (result) { toastr.success(t('Two-factor_authentication_disabled')); } else { - return toastr.error(t('Invalid_two_factor_code')); + toastr.error(t('Invalid_two_factor_code')); } }); }); @@ -87,7 +87,7 @@ Template.accountSecurity.events({ }, 'click .regenerate-codes'(event, instance) { - swal({ + modal.open({ title: t('Two-factor_authentication'), text: t('Open_your_authentication_app_and_enter_the_code'), type: 'input', @@ -109,7 +109,7 @@ Template.accountSecurity.events({ if (result) { instance.showBackupCodes(result.codes); } else { - return toastr.error(t('Invalid_two_factor_code')); + toastr.error(t('Invalid_two_factor_code')); } }); }); @@ -130,7 +130,7 @@ Template.accountSecurity.onCreated(function() { return (index + 1) % 4 === 0 && index < 11 ? `${ value }\n` : `${ value } `; }).join(''); const codes = `${ backupCodes }`; - swal({ + modal.open({ title: t('Backup_codes'), text: `${ t('Make_sure_you_have_a_copy_of_your_codes', { codes }) }`, html: true diff --git a/packages/rocketchat-authorization/client/views/permissionsRole.js b/packages/rocketchat-authorization/client/views/permissionsRole.js index be70ede7d007..542461439333 100644 --- a/packages/rocketchat-authorization/client/views/permissionsRole.js +++ b/packages/rocketchat-authorization/client/views/permissionsRole.js @@ -105,7 +105,7 @@ Template.permissionsRole.helpers({ Template.permissionsRole.events({ 'click .remove-user'(e, instance) { e.preventDefault(); - swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -120,7 +120,7 @@ Template.permissionsRole.events({ return handleError(error); } - swal({ + modal.open({ title: t('Removed'), text: t('User_removed'), type: 'success', diff --git a/packages/rocketchat-channel-settings/client/views/channelSettings.js b/packages/rocketchat-channel-settings/client/views/channelSettings.js index a5fe524a756b..3370645d43f2 100644 --- a/packages/rocketchat-channel-settings/client/views/channelSettings.js +++ b/packages/rocketchat-channel-settings/client/views/channelSettings.js @@ -83,7 +83,7 @@ Template.channelSettings.helpers({ Template.channelSettings.events({ 'click .delete'() { - return swal({ + modal.open({ title: t('Are_you_sure'), text: t('Delete_Room_Warning'), type: 'warning', @@ -94,13 +94,11 @@ Template.channelSettings.events({ closeOnConfirm: false, html: false }, () => { - swal.disableButtons(); Meteor.call('eraseRoom', this.rid, function(error) { if (error) { - handleError(error); - return swal.enableButtons(); + return handleError(error); } - swal({ + modal.open({ title: t('Deleted'), text: t('Room_has_been_deleted'), type: 'success', @@ -309,7 +307,7 @@ Template.channelSettings.onCreated(function() { }; if (room['default']) { if (RocketChat.authz.hasRole(Meteor.userId(), 'admin')) { - swal({ + modal.open({ title: t('Room_default_change_to_private_will_be_default_no_more'), type: 'warning', showCancelButton: true, @@ -388,7 +386,7 @@ Template.channelSettings.onCreated(function() { return RocketChat.authz.hasAtLeastOnePermission(['archive-room', 'unarchive-room'], room._id); }, save(value, room) { - return swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -398,16 +396,14 @@ Template.channelSettings.onCreated(function() { closeOnConfirm: false, html: false }, function(confirmed) { - swal.disableButtons(); if (confirmed) { const action = value ? 'archiveRoom' : 'unarchiveRoom'; - return Meteor.call(action, room._id, function(err) { + Meteor.call(action, room._id, function(err) { if (err) { - swal.enableButtons(); handleError(err); } - swal({ + modal.open({ title: value ? t('Room_archived') : t('Room_has_been_archived'), text: value ? t('Room_has_been_archived') : t('Room_has_been_unarchived'), type: 'success', @@ -415,7 +411,7 @@ Template.channelSettings.onCreated(function() { showConfirmButton: false }); - return RocketChat.callbacks.run(action, room); + RocketChat.callbacks.run(action, room); }); } else { return $('.channel-settings form [name=\'archived\']').prop('checked', !!room.archived); diff --git a/packages/rocketchat-custom-sounds/client/admin/soundInfo.js b/packages/rocketchat-custom-sounds/client/admin/soundInfo.js index 1a40506fed3c..81fe003aba48 100644 --- a/packages/rocketchat-custom-sounds/client/admin/soundInfo.js +++ b/packages/rocketchat-custom-sounds/client/admin/soundInfo.js @@ -39,7 +39,7 @@ Template.soundInfo.events({ const sound = instance.sound.get(); if (sound != null) { const _id = sound._id; - swal({ + modal.open({ title: t('Are_you_sure'), text: t('Custom_Sound_Delete_Warning'), type: 'warning', @@ -50,14 +50,11 @@ Template.soundInfo.events({ closeOnConfirm: false, html: false }, function() { - swal.disableButtons(); - Meteor.call('deleteCustomSound', _id, (error/*, result*/) => { if (error) { handleError(error); - swal.enableButtons(); } else { - swal({ + modal.open({ title: t('Deleted'), text: t('Custom_Sound_Has_Been_Deleted'), type: 'success', diff --git a/packages/rocketchat-emoji-custom/admin/emojiInfo.js b/packages/rocketchat-emoji-custom/admin/emojiInfo.js index f839c38312dd..5758043bb5e7 100644 --- a/packages/rocketchat-emoji-custom/admin/emojiInfo.js +++ b/packages/rocketchat-emoji-custom/admin/emojiInfo.js @@ -47,7 +47,7 @@ Template.emojiInfo.events({ const emoji = instance.emoji.get(); if (emoji != null) { const _id = emoji._id; - swal({ + modal.open({ title: t('Are_you_sure'), text: t('Custom_Emoji_Delete_Warning'), type: 'warning', @@ -58,14 +58,11 @@ Template.emojiInfo.events({ closeOnConfirm: false, html: false }, function() { - swal.disableButtons(); - Meteor.call('deleteEmojiCustom', _id, (error/*, result*/) => { if (error) { - handleError(error); - swal.enableButtons(); + return handleError(error); } else { - swal({ + modal.open({ title: t('Deleted'), text: t('Custom_Emoji_Has_Been_Deleted'), type: 'success', diff --git a/packages/rocketchat-integrations/client/views/integrationsIncoming.js b/packages/rocketchat-integrations/client/views/integrationsIncoming.js index 38e4ebfcc7a3..e872eaba9c09 100644 --- a/packages/rocketchat-integrations/client/views/integrationsIncoming.js +++ b/packages/rocketchat-integrations/client/views/integrationsIncoming.js @@ -159,7 +159,7 @@ Template.integrationsIncoming.events({ 'click .submit > .delete': () => { const params = Template.instance().data.params(); - swal({ + modal.open({ title: t('Are_you_sure'), text: t('You_will_not_be_able_to_recover'), type: 'warning', @@ -172,9 +172,9 @@ Template.integrationsIncoming.events({ }, () => { Meteor.call('deleteIncomingIntegration', params.id, (err) => { if (err) { - handleError(err); + return handleError(err); } else { - swal({ + modal.open({ title: t('Deleted'), text: t('Your_entry_has_been_deleted'), type: 'success', diff --git a/packages/rocketchat-integrations/client/views/integrationsOutgoing.js b/packages/rocketchat-integrations/client/views/integrationsOutgoing.js index 77f4ddf0748e..415650371fd1 100644 --- a/packages/rocketchat-integrations/client/views/integrationsOutgoing.js +++ b/packages/rocketchat-integrations/client/views/integrationsOutgoing.js @@ -224,7 +224,7 @@ Template.integrationsOutgoing.events({ 'click .submit > .delete': () => { const params = Template.instance().data.params(); - swal({ + modal.open({ title: t('Are_you_sure'), text: t('You_will_not_be_able_to_recover'), type: 'warning', @@ -239,7 +239,7 @@ Template.integrationsOutgoing.events({ if (err) { handleError(err); } else { - swal({ + modal.open({ title: t('Deleted'), text: t('Your_entry_has_been_deleted'), type: 'success', diff --git a/packages/rocketchat-lib/client/lib/settings.js b/packages/rocketchat-lib/client/lib/settings.js index 03896cd11514..5614cf2b7c1e 100644 --- a/packages/rocketchat-lib/client/lib/settings.js +++ b/packages/rocketchat-lib/client/lib/settings.js @@ -61,7 +61,7 @@ Meteor.startup(function() { Meteor.setTimeout(function() { const currentUrl = location.origin + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX; if (__meteor_runtime_config__.ROOT_URL.replace(/\/$/, '') !== currentUrl) { - swal({ + modal.open({ type: 'warning', title: t('Warning'), text: `${ t('The_setting_s_is_configured_to_s_and_you_are_accessing_from_s', t('Site_Url'), siteUrl, currentUrl) }

${ t('Do_you_want_to_change_to_s_question', currentUrl) }`, @@ -72,7 +72,7 @@ Meteor.startup(function() { html: true }, function() { Meteor.call('saveSetting', 'Site_Url', currentUrl, function() { - swal({ + modal.open({ title: t('Saved'), type: 'success', timer: 1000, diff --git a/packages/rocketchat-livechat/app/client/lib/commands.js b/packages/rocketchat-livechat/app/client/lib/commands.js index f215fdad0c96..57c21c2951a7 100644 --- a/packages/rocketchat-livechat/app/client/lib/commands.js +++ b/packages/rocketchat-livechat/app/client/lib/commands.js @@ -1,4 +1,4 @@ -/* globals LivechatVideoCall, Livechat */ +/* globals LivechatVideoCall, Livechat, swal */ // Functions to call on messages of type 'command' this.Commands = { survey() { diff --git a/packages/rocketchat-livechat/app/client/views/options.js b/packages/rocketchat-livechat/app/client/views/options.js index 0329f6c73f63..653c916a68b7 100644 --- a/packages/rocketchat-livechat/app/client/views/options.js +++ b/packages/rocketchat-livechat/app/client/views/options.js @@ -1,4 +1,4 @@ -/* globals Department, Livechat */ +/* globals Department, Livechat, swal */ Template.options.helpers({ showDepartments() { diff --git a/packages/rocketchat-livechat/app/client/views/survey.js b/packages/rocketchat-livechat/app/client/views/survey.js index 51d3928cd668..0bde47e041b8 100644 --- a/packages/rocketchat-livechat/app/client/views/survey.js +++ b/packages/rocketchat-livechat/app/client/views/survey.js @@ -1,3 +1,5 @@ +/* globals swal */ + Template.survey.events({ 'click button.skip'(e, instance) { instance.$('#survey').remove(); diff --git a/packages/rocketchat-livechat/app/client/views/switchDepartment.js b/packages/rocketchat-livechat/app/client/views/switchDepartment.js index 70ce6893d17b..a343e8d3334e 100644 --- a/packages/rocketchat-livechat/app/client/views/switchDepartment.js +++ b/packages/rocketchat-livechat/app/client/views/switchDepartment.js @@ -1,4 +1,4 @@ -/* globals Department, Livechat */ +/* globals Department, Livechat, swal */ Template.switchDepartment.helpers({ departments() { diff --git a/packages/rocketchat-livechat/app/package-lock.json b/packages/rocketchat-livechat/app/package-lock.json index 1c2c13918a82..ca28ccbd474c 100644 --- a/packages/rocketchat-livechat/app/package-lock.json +++ b/packages/rocketchat-livechat/app/package-lock.json @@ -633,7 +633,7 @@ "isarray": "1.0.0", "process-nextick-args": "1.0.7", "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", + "string_decoder": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", "util-deprecate": "1.0.2" } }, @@ -736,19 +736,11 @@ "strip-ansi": "3.0.1" } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", - "requires": { - "safe-buffer": "5.1.1" - } - }, "string_decoder": { "version": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "requires": { - "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + "safe-buffer": "5.1.1" } }, "stringstream": { diff --git a/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationFacebook.js b/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationFacebook.js index 0556f8c09f7d..75bbdce564b3 100644 --- a/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationFacebook.js +++ b/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationFacebook.js @@ -1,3 +1,5 @@ +/* globals swal */ + Template.livechatIntegrationFacebook.helpers({ pages() { return Template.instance().pages.get(); diff --git a/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationWebhook.js b/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationWebhook.js index fa3b7c793aa7..2a5602328364 100644 --- a/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationWebhook.js +++ b/packages/rocketchat-livechat/client/views/app/integrations/livechatIntegrationWebhook.js @@ -47,7 +47,11 @@ Template.livechatIntegrationWebhook.events({ if (err) { return handleError(err); } - swal(t('It_works'), null, 'success'); + modal.open({ + title: t('It_works'), + type: 'success', + timer: 2000 + }); }); } }, diff --git a/packages/rocketchat-livechat/client/views/app/livechatCustomFields.js b/packages/rocketchat-livechat/client/views/app/livechatCustomFields.js index cccb8defc91c..9610f2126c2b 100644 --- a/packages/rocketchat-livechat/client/views/app/livechatCustomFields.js +++ b/packages/rocketchat-livechat/client/views/app/livechatCustomFields.js @@ -9,7 +9,7 @@ Template.livechatCustomFields.events({ e.preventDefault(); e.stopPropagation(); - swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -23,7 +23,7 @@ Template.livechatCustomFields.events({ if (error) { return handleError(error); } - swal({ + modal.open({ title: t('Removed'), text: t('Field_removed'), type: 'success', diff --git a/packages/rocketchat-livechat/client/views/app/livechatDepartments.js b/packages/rocketchat-livechat/client/views/app/livechatDepartments.js index aac3a2828582..34a41d081d2d 100644 --- a/packages/rocketchat-livechat/client/views/app/livechatDepartments.js +++ b/packages/rocketchat-livechat/client/views/app/livechatDepartments.js @@ -9,7 +9,7 @@ Template.livechatDepartments.events({ e.preventDefault(); e.stopPropagation(); - swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -23,7 +23,7 @@ Template.livechatDepartments.events({ if (error) { return handleError(error); } - swal({ + modal.open({ title: t('Removed'), text: t('Department_removed'), type: 'success', diff --git a/packages/rocketchat-livechat/client/views/app/livechatTriggers.js b/packages/rocketchat-livechat/client/views/app/livechatTriggers.js index cbe198de740b..51054c44a85f 100644 --- a/packages/rocketchat-livechat/client/views/app/livechatTriggers.js +++ b/packages/rocketchat-livechat/client/views/app/livechatTriggers.js @@ -9,7 +9,7 @@ Template.livechatTriggers.events({ e.preventDefault(); e.stopPropagation(); - swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -23,7 +23,7 @@ Template.livechatTriggers.events({ if (error) { return handleError(error); } - swal({ + modal.open({ title: t('Removed'), text: t('Trigger_removed'), type: 'success', @@ -42,7 +42,7 @@ Template.livechatTriggers.events({ 'click .delete-trigger'(e/*, instance*/) { e.preventDefault(); - swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -57,7 +57,7 @@ Template.livechatTriggers.events({ return handleError(error); } - swal({ + modal.open({ title: t('Removed'), text: t('Trigger_removed'), type: 'success', diff --git a/packages/rocketchat-livechat/client/views/app/livechatUsers.js b/packages/rocketchat-livechat/client/views/app/livechatUsers.js index 18b23c535845..926dd69fdeed 100644 --- a/packages/rocketchat-livechat/client/views/app/livechatUsers.js +++ b/packages/rocketchat-livechat/client/views/app/livechatUsers.js @@ -68,7 +68,7 @@ Template.livechatUsers.events({ 'click .remove-manager'(e/*, instance*/) { e.preventDefault(); - swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -82,7 +82,7 @@ Template.livechatUsers.events({ if (error) { return handleError(error); } - swal({ + modal.open({ title: t('Removed'), text: t('Manager_removed'), type: 'success', @@ -95,7 +95,7 @@ Template.livechatUsers.events({ 'click .remove-agent'(e/*, instance*/) { e.preventDefault(); - swal({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -109,7 +109,7 @@ Template.livechatUsers.events({ if (error) { return handleError(error); } - swal({ + modal.open({ title: t('Removed'), text: t('Agent_removed'), type: 'success', diff --git a/packages/rocketchat-livechat/client/views/app/tabbar/visitorInfo.js b/packages/rocketchat-livechat/client/views/app/tabbar/visitorInfo.js index 6ec3b0267126..e23925b2a91c 100644 --- a/packages/rocketchat-livechat/client/views/app/tabbar/visitorInfo.js +++ b/packages/rocketchat-livechat/client/views/app/tabbar/visitorInfo.js @@ -154,7 +154,7 @@ Template.visitorInfo.events({ 'click .close-livechat'(event) { event.preventDefault(); - swal({ + modal.open({ title: t('Closing_chat'), type: 'input', inputPlaceholder: t('Please_add_a_comment'), @@ -162,12 +162,12 @@ Template.visitorInfo.events({ closeOnConfirm: false }, (inputValue) => { if (!inputValue) { - swal.showInputError(t('Please_add_a_comment_to_close_the_room')); + modal.showInputError(t('Please_add_a_comment_to_close_the_room')); return false; } if (s.trim(inputValue) === '') { - swal.showInputError(t('Please_add_a_comment_to_close_the_room')); + modal.showInputError(t('Please_add_a_comment_to_close_the_room')); return false; } @@ -175,7 +175,7 @@ Template.visitorInfo.events({ if (error) { return handleError(error); } - swal({ + modal.open({ title: t('Chat_closed'), text: t('Chat_closed_successfully'), type: 'success', @@ -189,7 +189,7 @@ Template.visitorInfo.events({ 'click .return-inquiry'(event) { event.preventDefault(); - swal({ + modal.open({ title: t('Would_you_like_to_return_the_inquiry'), type: 'warning', showCancelButton: true, diff --git a/packages/rocketchat-livechat/client/views/sideNav/livechat.js b/packages/rocketchat-livechat/client/views/sideNav/livechat.js index 83252463a477..659850b88319 100644 --- a/packages/rocketchat-livechat/client/views/sideNav/livechat.js +++ b/packages/rocketchat-livechat/client/views/sideNav/livechat.js @@ -100,7 +100,7 @@ Template.livechat.events({ event.preventDefault(); event.stopPropagation(); - swal({ + modal.open({ title: t('Livechat_Take_Confirm'), text: `${ t('Message') }: ${ this.message }`, showCancelButton: true, diff --git a/packages/rocketchat-message-snippet/client/actionButton.js b/packages/rocketchat-message-snippet/client/actionButton.js index 2e61fe5ecd00..cb627aafa6a4 100644 --- a/packages/rocketchat-message-snippet/client/actionButton.js +++ b/packages/rocketchat-message-snippet/client/actionButton.js @@ -13,20 +13,19 @@ Meteor.startup(function() { action() { const message = this._arguments[1]; - swal({ + modal.open({ title: 'Create a Snippet', text: 'The name of your snippet (with file extension):', type: 'input', showCancelButton: true, closeOnConfirm: false, - animation: 'slide-from-top', inputPlaceholder: 'Snippet name' }, function(filename) { if (filename === false) { return false; } if (filename === '') { - swal.showInputError('You need to write something!'); + modal.showInputError('You need to write something!'); return false; } message.snippeted = true; @@ -34,7 +33,12 @@ Meteor.startup(function() { if (error) { return handleError(error); } - swal('Nice!', `Snippet '${ filename }' created.`, 'success'); + modal.open({ + title: t('Nice'), + text: `Snippet '${ filename }' created.`, + type: 'success', + timer: 2000 + }); }); }); diff --git a/packages/rocketchat-oauth2-server-config/admin/client/views/oauthApp.js b/packages/rocketchat-oauth2-server-config/admin/client/views/oauthApp.js index 0bf2d9e0e52b..b09c186e04a7 100644 --- a/packages/rocketchat-oauth2-server-config/admin/client/views/oauthApp.js +++ b/packages/rocketchat-oauth2-server-config/admin/client/views/oauthApp.js @@ -33,7 +33,7 @@ Template.oauthApp.helpers({ Template.oauthApp.events({ 'click .submit > .delete'() { const params = Template.instance().data.params(); - swal({ + modal.open({ title: t('Are_you_sure'), text: t('You_will_not_be_able_to_recover'), type: 'warning', @@ -45,7 +45,7 @@ Template.oauthApp.events({ html: false }, function() { Meteor.call('deleteOAuthApp', params.id, function() { - swal({ + modal.open({ title: t('Deleted'), text: t('Your_entry_has_been_deleted'), type: 'success', diff --git a/packages/rocketchat-otr/client/rocketchat.otr.room.js b/packages/rocketchat-otr/client/rocketchat.otr.room.js index d0f9929e0720..24d7b7b212bb 100644 --- a/packages/rocketchat-otr/client/rocketchat.otr.room.js +++ b/packages/rocketchat-otr/client/rocketchat.otr.room.js @@ -202,7 +202,7 @@ RocketChat.OTR.Room = class { this.reset(); } - swal({ + modal.open({ title: `${ TAPi18n.__('OTR') }`, text: TAPi18n.__('Username_wants_to_start_otr_Do_you_want_to_accept', { username: user.username }), html: true, @@ -222,7 +222,7 @@ RocketChat.OTR.Room = class { timeout = Meteor.setTimeout(() => { this.establishing.set(false); - swal.close(); + modal.close(); }, 10000); break; @@ -237,7 +237,7 @@ RocketChat.OTR.Room = class { if (this.establishing.get()) { this.reset(); const user = Meteor.users.findOne(this.peerId); - swal({ + modal.open({ title: `${ TAPi18n.__('OTR') }`, text: TAPi18n.__('Username_denied_the_OTR_session', { username: user.username }), html: true @@ -249,7 +249,7 @@ RocketChat.OTR.Room = class { if (this.established.get()) { this.reset(); const user = Meteor.users.findOne(this.peerId); - swal({ + modal.open({ title: `${ TAPi18n.__('OTR') }`, text: TAPi18n.__('Username_ended_the_OTR_session', { username: user.username }), html: true diff --git a/packages/rocketchat-otr/client/views/otrFlexTab.js b/packages/rocketchat-otr/client/views/otrFlexTab.js index 50c813b380e5..d7d2b0c6de24 100644 --- a/packages/rocketchat-otr/client/views/otrFlexTab.js +++ b/packages/rocketchat-otr/client/views/otrFlexTab.js @@ -34,7 +34,11 @@ Template.otrFlexTab.events({ if (otr) { otr.handshake(); t.timeout = Meteor.setTimeout(() => { - swal('Timeout', '', 'error'); + modal.open({ + title: t('Timeout'), + type: 'error', + timer: 2000 + }); otr.establishing.set(false); }, 10000); } @@ -46,7 +50,11 @@ Template.otrFlexTab.events({ otr.reset(); otr.handshake(true); t.timeout = Meteor.setTimeout(() => { - swal('Timeout', '', 'error'); + modal.open({ + title: t('Timeout'), + type: 'error', + timer: 2000 + }); otr.establishing.set(false); }, 10000); } diff --git a/packages/rocketchat-theme/client/imports/components/modal.css b/packages/rocketchat-theme/client/imports/components/modal.css index d145d883bed0..6f6a8701883a 100644 --- a/packages/rocketchat-theme/client/imports/components/modal.css +++ b/packages/rocketchat-theme/client/imports/components/modal.css @@ -1,5 +1,6 @@ .rc-modal { min-width: 400px; + max-width: 500px; animation: dropdown-show 0.3s cubic-bezier(0.45, 0.05, 0.55, 0.95); @@ -35,10 +36,6 @@ transform: rotate(45deg); font-size: 20px; - - &:hover { - color: var(--color-link-active); - } } &__header { @@ -60,10 +57,52 @@ padding: 16px; animation: dropdown-show 0.1s cubic-bezier(0.45, 0.05, 0.55, 0.95); + align-items: center; + } + + &__content-icon { + margin: 1.2rem; + + font-size: 6rem; + + &--modal-warning { + color: var(--rc-color-alert); + } + + &--modal-success { + color: var(--rc-color-success-light); + } + + &--modal-info { + color: var(--rc-color-alert); + } + + &--modal-error { + color: var(--rc-color-error-light); + } + } + + &__content-text { + text-align: center; + word-break: break-word; + + font-size: 1rem; + line-height: 1.5; + } + + &__content-error { + display: none; + + width: 100%; + margin: 0.5rem 0; + + text-align: center; + word-break: break-word; - white-space: nowrap; + color: var(--color-white); + background: var(--rc-color-error); - background-color: var(--modal-background); + line-height: 2; } &__footer { diff --git a/packages/rocketchat-theme/client/imports/forms/button.css b/packages/rocketchat-theme/client/imports/forms/button.css index 33277ebd0008..011bf1ef104e 100644 --- a/packages/rocketchat-theme/client/imports/forms/button.css +++ b/packages/rocketchat-theme/client/imports/forms/button.css @@ -26,6 +26,10 @@ background: inherit; } + &--invisible { + visibility: hidden; + } + &--primary { color: var(--button-primary-text-color); border: 0; @@ -33,15 +37,12 @@ } &--secondary { - color: var(--button-secondary-text-color); border: 0; - background-color: var(--button-secondary-background); } &--cancel { color: var(--button-primary-text-color); border: 0; - background-color: var(--button-cancel-color); } &--small { diff --git a/packages/rocketchat-ui-account/client/accountProfile.js b/packages/rocketchat-ui-account/client/accountProfile.js index 938e7e6e664e..76418e2181cf 100644 --- a/packages/rocketchat-ui-account/client/accountProfile.js +++ b/packages/rocketchat-ui-account/client/accountProfile.js @@ -248,7 +248,7 @@ Template.accountProfile.onCreated(function() { if (results) { toastr.remove(); toastr.success(t('Profile_saved_successfully')); - swal.close(); + modal.close(); instance.clearForm(); self.password.set(); } @@ -337,7 +337,7 @@ Template.accountProfile.events({ if (!reqPass) { return instance.save(undefined, () => setTimeout(() => send.removeClass('loading'), 1000)); } - swal({ + modal.open({ title: t('Please_enter_your_password'), text: t('For_your_security_you_must_enter_your_current_password_to_continue'), type: 'input', @@ -352,7 +352,7 @@ Template.accountProfile.events({ toastr.warning(t('Please_wait_while_your_profile_is_being_saved')); instance.save(SHA256(typedPassword), () => send.removeClass('loading')); } else { - swal.showInputError(t('You_need_to_type_in_your_password_in_order_to_do_this')); + modal.showInputError(t('You_need_to_type_in_your_password_in_order_to_do_this')); return false; } }); @@ -379,7 +379,7 @@ Template.accountProfile.events({ e.preventDefault(); const user = Meteor.user(); if (s.trim(user && user.services && user.services.password && user.services.password.bcrypt)) { - swal({ + modal.open({ title: t('Are_you_sure_you_want_to_delete_your_account'), text: t('If_you_are_sure_type_in_your_password'), type: 'input', @@ -395,18 +395,18 @@ Template.accountProfile.events({ Meteor.call('deleteUserOwnAccount', SHA256(typedPassword), function(error) { if (error) { toastr.remove(); - swal.showInputError(t('Your_password_is_wrong')); + modal.showInputError(t('Your_password_is_wrong')); } else { - swal.close(); + modal.close(); } }); } else { - swal.showInputError(t('You_need_to_type_in_your_password_in_order_to_do_this')); + modal.showInputError(t('You_need_to_type_in_your_password_in_order_to_do_this')); return false; } }); } else { - swal({ + modal.open({ title: t('Are_you_sure_you_want_to_delete_your_account'), text: t('If_you_are_sure_type_in_your_username'), type: 'input', @@ -422,13 +422,13 @@ Template.accountProfile.events({ Meteor.call('deleteUserOwnAccount', deleteConfirmation, function(error) { if (error) { toastr.remove(); - swal.showInputError(t('Your_password_is_wrong')); + modal.showInputError(t('Your_password_is_wrong')); } else { - swal.close(); + modal.close(); } }); } else { - swal.showInputError(t('You_need_to_type_in_your_username_in_order_to_do_this')); + modal.showInputError(t('You_need_to_type_in_your_username_in_order_to_do_this')); return false; } }); diff --git a/packages/rocketchat-ui-admin/client/admin.js b/packages/rocketchat-ui-admin/client/admin.js index f3ce8fc6874a..75da95af9476 100644 --- a/packages/rocketchat-ui-admin/client/admin.js +++ b/packages/rocketchat-ui-admin/client/admin.js @@ -431,12 +431,12 @@ Template.admin.events({ closeOnConfirm: true, inputPlaceholder: TAPi18n.__('Custom_oauth_unique_name') }; - swal(config, function(inputValue) { + modal.open(config, function(inputValue) { if (inputValue === false) { return false; } if (inputValue === '') { - swal.showInputError(TAPi18n.__('Name_cant_be_empty')); + modal.showInputError(TAPi18n.__('Name_cant_be_empty')); return false; } Meteor.call('addOAuthService', inputValue, function(err) { @@ -467,7 +467,7 @@ Template.admin.events({ cancelButtonText: TAPi18n.__('Cancel'), closeOnConfirm: true }; - swal(config, function() { + modal.open(config, function() { Meteor.call('removeOAuthService', name); }); }, diff --git a/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js b/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js index 260a1ed42c55..5c66bc020337 100644 --- a/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js +++ b/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js @@ -74,7 +74,7 @@ Template.adminRoomInfo.helpers({ Template.adminRoomInfo.events({ 'click .delete'() { - swal({ + modal.open({ title: t('Are_you_sure'), text: t('Delete_Room_Warning'), type: 'warning', @@ -85,13 +85,11 @@ Template.adminRoomInfo.events({ closeOnConfirm: false, html: false }, () => { - swal.disableButtons(); Meteor.call('eraseRoom', this.rid, function(error) { if (error) { handleError(error); - swal.enableButtons(); } else { - swal({ + modal.open({ title: t('Deleted'), text: t('Room_has_been_deleted'), type: 'success', @@ -209,7 +207,7 @@ Template.adminRoomInfo.onCreated(function() { if (!AdminChatRoom.findOne(rid, { fields: { 'default': 1 }})['default']) { return saveRoomSettings(); } - swal({ + modal.open({ title: t('Room_default_change_to_private_will_be_default_no_more'), type: 'warning', showCancelButton: true, diff --git a/packages/rocketchat-ui-flextab/client/tabs/uploadedFilesList.js b/packages/rocketchat-ui-flextab/client/tabs/uploadedFilesList.js index c5e1e400af61..28847934b5df 100644 --- a/packages/rocketchat-ui-flextab/client/tabs/uploadedFilesList.js +++ b/packages/rocketchat-ui-flextab/client/tabs/uploadedFilesList.js @@ -77,7 +77,7 @@ Template.uploadedFilesList.events({ 'click .icon-trash'() { const self = this; - return swal({ + modal.open({ title: TAPi18n.__('Are_you_sure'), text: TAPi18n.__('You_will_not_be_able_to_recover_file'), type: 'warning', @@ -88,7 +88,7 @@ Template.uploadedFilesList.events({ closeOnConfirm: false, html: false }, function() { - swal({ + modal.open({ title: TAPi18n.__('Deleted'), text: TAPi18n.__('Your_file_has_been_deleted'), type: 'success', diff --git a/packages/rocketchat-ui-flextab/client/tabs/userInfo.js b/packages/rocketchat-ui-flextab/client/tabs/userInfo.js index 498e676889d6..0e400ff533d8 100644 --- a/packages/rocketchat-ui-flextab/client/tabs/userInfo.js +++ b/packages/rocketchat-ui-flextab/client/tabs/userInfo.js @@ -260,7 +260,7 @@ Template.userInfo.events({ const room = ChatRoom.findOne(rid); const user = instance.user.get(); if (user && RocketChat.authz.hasAllPermission('remove-user', rid)) { - return swal({ + modal.open({ title: t('Are_you_sure'), text: t('The_user_will_be_removed_from_s', room.name), type: 'warning', @@ -271,11 +271,11 @@ Template.userInfo.events({ closeOnConfirm: false, html: false }, () => { - return Meteor.call('removeUserFromRoom', { rid, username: user.username }, (err) => { + Meteor.call('removeUserFromRoom', { rid, username: user.username }, (err) => { if (err) { return handleError(err); } - swal({ + modal.open({ title: t('Removed'), text: t('User_has_been_removed_from_s', room.name), type: 'success', @@ -283,11 +283,11 @@ Template.userInfo.events({ showConfirmButton: false }); - return instance.clear(); + instance.clear(); }); }); } else { - return toastr.error(TAPi18n.__('error-not-allowed')); + toastr.error(TAPi18n.__('error-not-allowed')); } }, @@ -297,7 +297,7 @@ Template.userInfo.events({ const room = ChatRoom.findOne(rid); const user = instance.user.get(); if (user && RocketChat.authz.hasAllPermission('mute-user', rid)) { - return swal({ + modal.open({ title: t('Are_you_sure'), text: t('The_user_wont_be_able_to_type_in_s', room.name), type: 'warning', @@ -308,11 +308,11 @@ Template.userInfo.events({ closeOnConfirm: false, html: false }, () => { - return Meteor.call('muteUserInRoom', { rid, username: user.username }, function(err) { + Meteor.call('muteUserInRoom', { rid, username: user.username }, function(err) { if (err) { return handleError(err); } - return swal({ + modal.open({ title: t('Muted'), text: t('User_has_been_muted_in_s', room.name), type: 'success', @@ -518,7 +518,7 @@ Template.userInfo.events({ e.preventDefault(); const user = instance.user.get(); if (user) { - return swal({ + modal.open({ title: t('Are_you_sure'), text: t('Delete_User_Warning'), type: 'warning', @@ -529,13 +529,11 @@ Template.userInfo.events({ closeOnConfirm: false, html: false }, function() { - swal.disableButtons(); - return Meteor.call('deleteUser', user._id, function(error) { + Meteor.call('deleteUser', user._id, function(error) { if (error) { handleError(error); - return swal.enableButtons(); } else { - swal({ + modal.open({ title: t('Deleted'), text: t('User_has_been_deleted'), type: 'success', @@ -543,7 +541,7 @@ Template.userInfo.events({ showConfirmButton: false }); - return instance.tabBar.close(); + instance.tabBar.close(); } }); }); diff --git a/packages/rocketchat-ui-login/client/reset-password/resetPassword.js b/packages/rocketchat-ui-login/client/reset-password/resetPassword.js index cd6c0181e3ca..8ba9f4b239f5 100644 --- a/packages/rocketchat-ui-login/client/reset-password/resetPassword.js +++ b/packages/rocketchat-ui-login/client/reset-password/resetPassword.js @@ -33,7 +33,7 @@ Template.resetPassword.events({ Meteor.call('setUserPassword', instance.find('[name=newPassword]').value, function(error) { if (error) { console.log(error); - swal({ + modal.open({ title: t('Error_changing_password'), type: 'error' }); @@ -49,7 +49,7 @@ Template.resetPassword.events({ RocketChat.callbacks.run('userPasswordReset'); FlowRouter.go('login'); } else { - swal({ + modal.open({ title: t('Error_changing_password'), type: 'error' }); diff --git a/packages/rocketchat-ui-master/client/main.js b/packages/rocketchat-ui-master/client/main.js index f8037bd6fe7f..05d98df004f2 100644 --- a/packages/rocketchat-ui-master/client/main.js +++ b/packages/rocketchat-ui-master/client/main.js @@ -17,7 +17,7 @@ Template.body.onRendered(function() { if (e.keyCode === 27 && e.shiftKey === true && (unread != null) && unread !== '') { e.preventDefault(); e.stopPropagation(); - return swal({ + modal.open({ title: t('Clear_all_unreads_question'), type: 'warning', confirmButtonText: t('Yes_clear_all'), @@ -188,9 +188,6 @@ Template.main.onRendered(function() { }, 100); }); return Tracker.autorun(function() { - swal.setDefaults({ - cancelButtonText: t('Cancel') - }); const user = Meteor.user(); if (RocketChat.getUserPreference(user, 'hideUsernames')) { $(document.body).on('mouseleave', 'button.thumb', function() { diff --git a/packages/rocketchat-ui-master/public/icons.svg b/packages/rocketchat-ui-master/public/icons.svg index 1a7ac0eb2829..dec3f96fee03 100644 --- a/packages/rocketchat-ui-master/public/icons.svg +++ b/packages/rocketchat-ui-master/public/icons.svg @@ -67,4 +67,8 @@ - + + + + + \ No newline at end of file diff --git a/packages/rocketchat-ui/client/lib/chatMessages.js b/packages/rocketchat-ui/client/lib/chatMessages.js index a021a9deaa44..8fa06d14def9 100644 --- a/packages/rocketchat-ui/client/lib/chatMessages.js +++ b/packages/rocketchat-ui/client/lib/chatMessages.js @@ -273,7 +273,7 @@ this.ChatMessages = class ChatMessages { confirmDeleteMsg(message, done = function() {}) { if (RocketChat.MessageTypes.isSystemMessage(message)) { return; } - swal({ + modal.open({ title: t('Are_you_sure'), text: t('You_will_not_be_able_to_recover'), type: 'warning', @@ -281,10 +281,9 @@ this.ChatMessages = class ChatMessages { confirmButtonColor: '#DD6B55', confirmButtonText: t('Yes_delete_it'), cancelButtonText: t('Cancel'), - closeOnConfirm: false, html: false }, () => { - swal({ + modal.open({ title: t('Deleted'), text: t('Your_entry_has_been_deleted'), type: 'success', @@ -300,9 +299,6 @@ this.ChatMessages = class ChatMessages { this.$input.focus(); return done(); }); - - // In order to avoid issue "[Callback not called when still animating](https://github.com/t4t5/sweetalert/issues/528)" - return $('.sweet-alert').addClass('visible'); } deleteMsg(message) { diff --git a/packages/rocketchat-ui/client/views/app/modal.html b/packages/rocketchat-ui/client/views/app/modal.html index b22780cd35f9..8c6b18a2e331 100644 --- a/packages/rocketchat-ui/client/views/app/modal.html +++ b/packages/rocketchat-ui/client/views/app/modal.html @@ -1,9 +1,7 @@ diff --git a/packages/rocketchat-ui/client/views/app/modal.js b/packages/rocketchat-ui/client/views/app/modal.js index 5d3b58b1ec41..45871b51fd06 100644 --- a/packages/rocketchat-ui/client/views/app/modal.js +++ b/packages/rocketchat-ui/client/views/app/modal.js @@ -6,6 +6,15 @@ this.modal = { config.confirmButtonText = config.confirmButtonText || t('Send'); config.cancelButtonText = config.cancelButtonText || t('Cancel'); + if (config.type === 'input') { + config.input = true; + config.type = false; + + if (!config.inputType) { + config.inputType = 'text'; + } + } + this.close(); this.renderedModal = Blaze.renderWithData(Template.rc_modal, config, document.body); this.fn = fn; @@ -24,15 +33,28 @@ this.modal = { clearTimeout(this.timer); } }, - confirm() { - this.fn(true); + confirm(value) { + if (this.fn) { + this.fn(value); + } else { + this.close(); + } + this.config.closeOnConfirm && this.close(); + }, + showInputError(text) { + const errorEl = document.querySelector('.rc-modal__content-error'); + errorEl.innerHTML = text; + errorEl.style.display = 'block'; } }; Template.rc_modal.helpers({ hasAction() { return !!this.action; + }, + modalIcon() { + return `modal-${ this.type }`; } }); @@ -41,11 +63,18 @@ Template.rc_modal.onRendered(function() { this.data.onRendered(); } - $('.rc-modal-wrapper').click(function(e) { - if (e.currentTarget === e.target) { + document.addEventListener('keydown', function(e) { + e.preventDefault(); + e.stopPropagation(); + + if (e.key === 'Enter') { + modal.confirm(true); + } + + if (e.key === 'Escape') { modal.close(); } - }); + }, {once: true}); }); Template.rc_modal.events({ @@ -56,7 +85,20 @@ Template.rc_modal.events({ 'click .js-close'() { modal.close(); }, - 'click .js-confirm'() { - modal.confirm(); + 'click .js-confirm'(e, instance) { + if (instance.data.input) { + return modal.confirm($('.js-modal-input').val()); + } + + modal.confirm(true); + }, + 'click .rc-modal-wrapper'(e, instance) { + if (instance.data.allowOutsideClick === false) { + return false; + } + + if (e.currentTarget === e.target) { + modal.close(); + } } }); diff --git a/packages/rocketchat-ui/client/views/app/popover.js b/packages/rocketchat-ui/client/views/app/popover.js index 9639989a38b3..5730706e8815 100644 --- a/packages/rocketchat-ui/client/views/app/popover.js +++ b/packages/rocketchat-ui/client/views/app/popover.js @@ -106,7 +106,7 @@ Template.popover.events({ if (e.currentTarget.dataset.id === 'report-abuse') { const message = t.data.data._arguments[1]; - swal({ + modal.open({ title: TAPi18n.__('Report_this_message_question_mark'), text: message.msg, inputPlaceholder: TAPi18n.__('Why_do_you_want_to_report_question_mark'), @@ -123,13 +123,13 @@ Template.popover.events({ } if (inputValue === '') { - swal.showInputError(TAPi18n.__('You_need_to_write_something')); + modal.showInputError(TAPi18n.__('You_need_to_write_something')); return false; } Meteor.call('reportMessage', message._id, inputValue); - swal({ + modal.open({ title: TAPi18n.__('Report_sent'), text: TAPi18n.__('Thank_you_exclamation_mark '), type: 'success', @@ -187,7 +187,7 @@ Template.popover.events({ if (e.currentTarget.dataset.id === 'hide') { const warnText = RocketChat.roomTypes.roomTypes[template].getUiText(UiTextContext.HIDE_WARNING); - swal({ + modal.open({ title: t('Are_you_sure'), text: warnText ? t(warnText, name) : '', type: 'warning', @@ -223,7 +223,7 @@ Template.popover.events({ case 'l': warnText = 'Hide_Livechat_Warning'; break; } - swal({ + modal.open({ title: t('Are_you_sure'), text: warnText ? t(warnText, name) : '', type: 'warning', @@ -237,14 +237,14 @@ Template.popover.events({ if (isConfirm) { Meteor.call('leaveRoom', rid, function(err) { if (err) { - swal({ + modal.open({ title: t('Warning'), text: handleError(err, false), type: 'warning', html: false }); } else { - swal.close(); + modal.close(); if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName()) && (Session.get('openedRoom') === rid)) { FlowRouter.go('home'); } @@ -252,8 +252,6 @@ Template.popover.events({ RoomManager.close(rid); } }); - } else { - swal.close(); } }); diff --git a/packages/rocketchat-videobridge/client/views/videoFlexTab.js b/packages/rocketchat-videobridge/client/views/videoFlexTab.js index cafbfe8d1538..9f6ca959111e 100644 --- a/packages/rocketchat-videobridge/client/views/videoFlexTab.js +++ b/packages/rocketchat-videobridge/client/views/videoFlexTab.js @@ -40,7 +40,7 @@ Template.videoFlexTab.onRendered(function() { RocketChat.TabBar.updateButton('video', { class: '' }); }; - swal({ + modal.open({ title: t('Video_Conference'), text: t('Start_video_call'), type: 'warning', diff --git a/packages/rocketchat-webrtc/client/WebRTCClass.js b/packages/rocketchat-webrtc/client/WebRTCClass.js index 1a506d578b04..94e851de7daa 100644 --- a/packages/rocketchat-webrtc/client/WebRTCClass.js +++ b/packages/rocketchat-webrtc/client/WebRTCClass.js @@ -427,7 +427,7 @@ class WebRTCClass { } const getScreen = (audioStream) => { const refresh = function() { - swal({ + modal.open({ type: 'warning', title: TAPi18n.__('Refresh_your_page_after_install_to_enable_screen_sharing') }); @@ -437,7 +437,7 @@ class WebRTCClass { const isFirefoxExtensionInstalled = this.navigator === 'firefox' && window.rocketchatscreenshare != null; if (!isChromeExtensionInstalled && !isFirefoxExtensionInstalled) { - swal({ + modal.open({ type: 'warning', title: TAPi18n.__('Screen_Share'), text: TAPi18n.__('You_need_install_an_extension_to_allow_screen_sharing'), @@ -738,7 +738,7 @@ class WebRTCClass { icon = 'phone'; title = `Group audio call from ${ subscription.name }`; } - swal({ + modal.open({ title: `${ title }`, text: 'Do you want to accept?', html: true, diff --git a/tests/end-to-end/ui/06-messaging.js b/tests/end-to-end/ui/06-messaging.js index 9f97b1c3ec4c..454c4d319997 100644 --- a/tests/end-to-end/ui/06-messaging.js +++ b/tests/end-to-end/ui/06-messaging.js @@ -47,44 +47,44 @@ function messagingTest() { }); it('it should show the confirm button', () => { - Global.sweetAlertConfirm.isVisible().should.be.true; + Global.modalConfirm.isVisible().should.be.true; }); it('it should show the cancel button', () => { - Global.sweetAlertCancel.isVisible().should.be.true; + Global.modalCancel.isVisible().should.be.true; }); it('it should show the file preview', () => { - Global.sweetAlertFilePreview.isVisible().should.be.true; + Global.modalFilePreview.isVisible().should.be.true; }); it('it should show the confirm button', () => { - Global.sweetAlertConfirm.isVisible().should.be.true; + Global.modalConfirm.isVisible().should.be.true; }); it('it should show the file title', () => { - Global.sweetAlertFileTitle.isVisible().should.be.true; + Global.modalFileTitle.isVisible().should.be.true; }); it('it should show the file name input', () => { - Global.sweetAlertFileName.isVisible().should.be.true; + Global.modalFileName.isVisible().should.be.true; }); it('it should fill the file name input', () => { - Global.sweetAlertFileName.setValue('File Name'); + Global.modalFileName.setValue('File Name'); }); it('it should show the file name input', () => { - Global.sweetAlertFileDescription.isVisible().should.be.true; + Global.modalFileDescription.isVisible().should.be.true; }); it('it should fill the file name input', () => { - Global.sweetAlertFileDescription.setValue('File Description'); + Global.modalFileDescription.setValue('File Description'); }); it('it should click the confirm', () => { - Global.sweetAlertConfirm.click(); - Global.sweetAlertConfirm.waitForVisible(5000, true); + Global.modalConfirm.click(); + Global.modalConfirm.waitForVisible(5000, true); }); it('it should show the file in the message', () => { @@ -195,8 +195,8 @@ function messageActionsTest() { it('it should delete the message', () => { mainContent.selectAction('delete'); - Global.sweetAlertConfirm.click(); - Global.sweetAlertOverlay.waitForVisible(3000, true); + Global.modalConfirm.click(); + Global.modalOverlay.waitForVisible(3000, true); }); it('it should not show the deleted message', () => { diff --git a/tests/end-to-end/ui/09-channel.js b/tests/end-to-end/ui/09-channel.js index 600eb9834704..7a62e467c7e0 100644 --- a/tests/end-to-end/ui/09-channel.js +++ b/tests/end-to-end/ui/09-channel.js @@ -384,13 +384,13 @@ describe('[Channel]', ()=> { channel.moveToObject(); sideNav.channelLeave.waitForVisible(5000); sideNav.channelLeave.click(); - Global.sweetAlert.waitForVisible(5000); + Global.modal.waitForVisible(5000); }); - it('it should show the sweet alert popup', () => { - Global.sweetAlert.waitForVisible(5000); - Global.sweetAlert.isVisible().should.be.true; - Global.sweetAlertConfirm.isVisible().should.be.true; + it('it should show the modal alert popup', () => { + Global.modal.waitForVisible(5000); + Global.modal.isVisible().should.be.true; + Global.modalConfirm.isVisible().should.be.true; }); it('it should close the popup', () => { diff --git a/tests/end-to-end/ui/10-user-preferences.js b/tests/end-to-end/ui/10-user-preferences.js index d6696a3c790e..ddcded73471f 100644 --- a/tests/end-to-end/ui/10-user-preferences.js +++ b/tests/end-to-end/ui/10-user-preferences.js @@ -78,11 +78,15 @@ describe('[User Preferences]', ()=> { preferencesMainContent.changeEmail(`EditedUserEmail${ username }@gmail.com`); }); + it.skip('it should put the password in the modal input', ()=> { + preferencesMainContent.acceptPasswordOverlay(password); + }); + it('it should save the settings', () => { preferencesMainContent.saveChanges(); }); - it.skip('it should put the password in the sweet alert input', () => { + it.skip('it should put the password in the modal input', () => { preferencesMainContent.acceptPasswordOverlay(password); }); diff --git a/tests/pageobjects/global.js b/tests/pageobjects/global.js index 91b142f73921..14b585831e41 100644 --- a/tests/pageobjects/global.js +++ b/tests/pageobjects/global.js @@ -1,22 +1,22 @@ class Global { - // Sweet Alerts - get sweetAlertOverlay() { return browser.element('.sweet-overlay'); } - get sweetAlert() { return browser.element('.sweet-alert'); } - get sweetAlertConfirm() { return browser.element('.sweet-alert .sa-confirm-button-container'); } - get sweetAlertCancel() { return browser.element('.sa-button-container .cancel'); } - get sweetAlertPasswordField() { return browser.element('.sweet-alert [type="password"]'); } - get sweetAlertFileName() { return browser.element('#file-name'); } - get sweetAlertFileDescription() { return browser.element('#file-description'); } - get sweetAlertFilePreview() { return browser.element('.upload-preview-file'); } - get sweetAlertFileTitle() { return browser.element('.upload-preview-title'); } + // Modal + get modalOverlay() { return browser.element('.rc-modal-wrapper'); } + get modal() { return browser.element('.rc-modal'); } + get modalConfirm() { return browser.element('.rc-modal .js-confirm'); } + get modalCancel() { return browser.element('.rc-modal .js-modal'); } + get modalPasswordField() { return browser.element('.rc-modal [type="password"]'); } + get modalFileName() { return browser.element('.rc-modal #file-name'); } + get modalFileDescription() { return browser.element('.rc-modal #file-description'); } + get modalFilePreview() { return browser.element('.rc-modal .upload-preview-file'); } + get modalFileTitle() { return browser.element('.rc-modal .upload-preview-title'); } get toastAlert() { return browser.element('.toast'); } confirmPopup() { - this.sweetAlertConfirm.waitForVisible(5000); + this.modalConfirm.waitForVisible(5000); browser.pause(500); - this.sweetAlertConfirm.click(); - this.sweetAlert.waitForVisible(5000, true); + this.modalConfirm.click(); + this.modal.waitForVisible(5000, true); } setWindowSize(width, height) {