Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Remove sweetalert from livechat facebook integration page #9274

Merged
merged 1 commit into from
Dec 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,8 @@
"Livechat_Dashboard": "Livechat Dashboard",
"Livechat_enabled": "Livechat enabled",
"Livechat_Facebook_Enabled": "Facebook integration enabled",
"Livechat_Facebook_API_Key": "Facebook API Key",
"Livechat_Facebook_API_Secret": "Facebook API Secret",
"Livechat_Facebook_API_Key": "OmniChannel API Key",
"Livechat_Facebook_API_Secret": "OmniChannel API Secret",
"Livechat_forward_open_chats": "Forward open chats",
"Livechat_forward_open_chats_timeout": "Timeout (in seconds) to forward chats",
"Livechat_guest_count": "Guest Counter",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* globals swal */

Template.livechatIntegrationFacebook.helpers({
pages() {
return Template.instance().pages.get();
Expand Down Expand Up @@ -35,7 +33,7 @@ Template.livechatIntegrationFacebook.onCreated(function() {

this.result = (successFn, errorFn = () => {}) => {
return (error, result) => {
if (result.success === false && (result.type === 'OAuthException' || typeof result.url !== 'undefined')) {
if (result && result.success === false && (result.type === 'OAuthException' || typeof result.url !== 'undefined')) {
const oauthWindow = window.open(result.url, 'facebook-integration-oauth', 'width=600,height=400');

const checkInterval = setInterval(() => {
Expand All @@ -48,7 +46,7 @@ Template.livechatIntegrationFacebook.onCreated(function() {
}
if (error) {
errorFn(error);
return swal({
return modal.open({
title: t('Error_loading_pages'),
text: error.reason,
type: 'error'
Expand Down Expand Up @@ -93,7 +91,7 @@ Template.livechatIntegrationFacebook.events({
'click .disable'(event, instance) {
event.preventDefault();

swal({
modal.open({
title: t('Disable_Facebook_integration'),
text: t('Are_you_sure_you_want_to_disable_Facebook_integration'),
type: 'warning',
Expand All @@ -111,7 +109,7 @@ Template.livechatIntegrationFacebook.events({
instance.enabled.set(false);
instance.pages.set([]);

swal({
modal.open({
title: t('Disabled'),
text: t('Integration_disabled'),
type: 'success',
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/views/app/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
this.modal = {
renderedModal: null,
open(config = {}, fn) {
config.confirmButtonText = config.confirmButtonText || t('Send');
config.confirmButtonText = config.confirmButtonText || (config.type === 'error' ? t('Ok') : t('Send'));
config.cancelButtonText = config.cancelButtonText || t('Cancel');
config.closeOnConfirm = config.closeOnConfirm == null ? true : config.closeOnConfirm;
config.showConfirmButton = config.showConfirmButton == null ? true : config.showConfirmButton;
Expand Down