Skip to content

Commit

Permalink
Merge pull request #9274 from RocketChat/fix-livechat-facebook-integr…
Browse files Browse the repository at this point in the history
…ation

[FIX] Remove sweetalert from livechat facebook integration page
  • Loading branch information
rodrigok authored Dec 29, 2017
2 parents 9c300c7 + cde94ab commit d986a7a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
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

0 comments on commit d986a7a

Please sign in to comment.