Skip to content
Snippets Groups Projects
Commit 0c2c3773 authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Fix to gitlab / wordpress custom oauth reconfiguring after settings changed

parent 9f90a39d
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,6 @@ Template.admin.events ...@@ -45,7 +45,6 @@ Template.admin.events
"click .submit .save": (e, t) -> "click .submit .save": (e, t) ->
group = FlowRouter.getParam('group') group = FlowRouter.getParam('group')
settings = Settings.find({ group: group }).fetch() settings = Settings.find({ group: group }).fetch()
console.log 'will save settings', JSON.stringify settings
updateSettings = [] updateSettings = []
for setting in settings for setting in settings
value = null value = null
...@@ -59,8 +58,6 @@ Template.admin.events ...@@ -59,8 +58,6 @@ Template.admin.events
if value? if value?
updateSettings.push { _id: setting._id, value: value } updateSettings.push { _id: setting._id, value: value }
console.log 'changed settings', JSON.stringify updateSettings
if not _.isEmpty updateSettings if not _.isEmpty updateSettings
RocketChat.settings.batchSet updateSettings, (err, success) -> RocketChat.settings.batchSet updateSettings, (err, success) ->
return toastr.error TAPi18next.t 'project:Error_updating_settings' if err return toastr.error TAPi18next.t 'project:Error_updating_settings' if err
......
...@@ -7,8 +7,18 @@ config = ...@@ -7,8 +7,18 @@ config =
Gitlab = new CustomOAuth 'gitlab', config Gitlab = new CustomOAuth 'gitlab', config
Meteor.startup -> if Meteor.isServer
Tracker.autorun -> Meteor.startup ->
if RocketChat.settings.get 'API_Gitlab_URL' RocketChat.models.Settings.find({ _id: 'API_Gitlab_URL' }).observe
config.serverURL = RocketChat.settings.get 'API_Gitlab_URL' added: (record) ->
Gitlab.configure config config.serverURL = RocketChat.settings.get 'API_Gitlab_URL'
Gitlab.configure config
changed: (record) ->
config.serverURL = RocketChat.settings.get 'API_Gitlab_URL'
Gitlab.configure config
else
Meteor.startup ->
Tracker.autorun ->
if RocketChat.settings.get 'API_Gitlab_URL'
config.serverURL = RocketChat.settings.get 'API_Gitlab_URL'
Gitlab.configure config
...@@ -7,8 +7,18 @@ config = ...@@ -7,8 +7,18 @@ config =
WordPress = new CustomOAuth 'wordpress', config WordPress = new CustomOAuth 'wordpress', config
Meteor.startup -> if Meteor.isServer
Tracker.autorun -> Meteor.startup ->
if RocketChat.settings.get 'API_Wordpress_URL' RocketChat.models.Settings.find({ _id: 'API_Wordpress_URL' }).observe
config.serverURL = RocketChat.settings.get 'API_Wordpress_URL' added: (record) ->
WordPress.configure config config.serverURL = RocketChat.settings.get 'API_Wordpress_URL'
WordPress.configure config
changed: (record) ->
config.serverURL = RocketChat.settings.get 'API_Wordpress_URL'
WordPress.configure config
else
Meteor.startup ->
Tracker.autorun ->
if RocketChat.settings.get 'API_Wordpress_URL'
config.serverURL = RocketChat.settings.get 'API_Wordpress_URL'
WordPress.configure config
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment