From 0ccaa6df34a519f2ea88f156e68a2d5cec4fe279 Mon Sep 17 00:00:00 2001
From: Gabriel Engel <gabriel.engel@gmail.com>
Date: Fri, 11 Mar 2016 15:19:57 -0300
Subject: [PATCH] oAuth -> OAuth

---
 HISTORY.md                                          |  4 ++--
 .../custom_oauth_server.coffee                      |  2 +-
 .../rocketchat-github-enterprise/startup.coffee     |  2 +-
 packages/rocketchat-gitlab/startup.coffee           |  2 +-
 .../server/startup/oAuthServicesUpdate.coffee       | 10 +++++-----
 .../rocketchat-lib/server/startup/settings.coffee   |  2 +-
 packages/rocketchat-wordpress/startup.coffee        | 13 ++++++++-----
 server/configuration/accounts_meld.coffee           |  2 +-
 8 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/HISTORY.md b/HISTORY.md
index 8bf79ef561d..b98df65cdc6 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -200,7 +200,7 @@
 - Enable editing via admin / users
 - Log error when trigger url returns 500
 - Bind starttls correctly for LDAP
-- Custom oAuth supporting json or plain content_types responses of the identity
+- Custom OAuth supporting json or plain content_types responses of the identity
 - Allow pass room id to direct rooms
 - Outgoing: Get the room from posted message to reply
 - Change Meteor.absoluteUrl to force SSL if Force_SSL is true
@@ -529,7 +529,7 @@
 - New RocketChat.RateLimiter
 - Favico.js update
 - Better RTL support
-- Remove custom oAuth record when removed from settings
+- Remove custom OAuth record when removed from settings
 - Improve Settings layout
 - Collapse sub groups of settings
 - Change translations in PT for False and True
diff --git a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee
index 28e69f233f3..6be8d313f60 100644
--- a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee
+++ b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee
@@ -110,7 +110,7 @@ class CustomOAuth
 			console.log 'id:', JSON.stringify identity, null, '  '
 
 			serviceData =
-				_oAuthCustom: true
+				_OAuthCustom: true
 				accessToken: accessToken
 
 			_.extend serviceData, identity
diff --git a/packages/rocketchat-github-enterprise/startup.coffee b/packages/rocketchat-github-enterprise/startup.coffee
index a9c8c2f336b..c92b9b3dd00 100644
--- a/packages/rocketchat-github-enterprise/startup.coffee
+++ b/packages/rocketchat-github-enterprise/startup.coffee
@@ -1,4 +1,4 @@
-RocketChat.settings.addGroup 'Accounts', ->
+RocketChat.settings.addGroup 'OAuth', ->
 	@section 'GitHub Enterprise', ->
 		enableQuery = {_id: 'Accounts_OAuth_GitHub_Enterprise', value: true}
 		@add 'Accounts_OAuth_GitHub_Enterprise', false, {type: 'boolean'}
diff --git a/packages/rocketchat-gitlab/startup.coffee b/packages/rocketchat-gitlab/startup.coffee
index 6f86e0578be..b501316b1c9 100644
--- a/packages/rocketchat-gitlab/startup.coffee
+++ b/packages/rocketchat-gitlab/startup.coffee
@@ -1,4 +1,4 @@
-RocketChat.settings.addGroup 'Accounts', ->
+RocketChat.settings.addGroup 'OAuth', ->
 	@section 'GitLab', ->
 		enableQuery = {_id: 'Accounts_OAuth_Gitlab', value: true}
 		@add 'Accounts_OAuth_Gitlab', false, { type: 'boolean', public: true }
diff --git a/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee b/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee
index 5a8e1186c00..4a5fbbdf96e 100644
--- a/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee
+++ b/packages/rocketchat-lib/server/startup/oAuthServicesUpdate.coffee
@@ -4,7 +4,7 @@ logger = new Logger 'rocketchat:lib',
 			type: 'info'
 
 timer = undefined
-oAuthServicesUpdate = ->
+OAuthServicesUpdate = ->
 	Meteor.clearTimeout timer if timer?
 
 	timer = Meteor.setTimeout ->
@@ -55,7 +55,7 @@ oAuthServicesUpdate = ->
 	, 2000
 
 
-oAuthServicesRemove = (_id) ->
+OAuthServicesRemove = (_id) ->
 	serviceName = _id.replace('Accounts_OAuth_Custom_', '')
 	ServiceConfiguration.configurations.remove {service: serviceName.toLowerCase()}
 
@@ -63,12 +63,12 @@ oAuthServicesRemove = (_id) ->
 RocketChat.models.Settings.find().observe
 	added: (record) ->
 		if /^Accounts_OAuth_.+/.test record._id
-			oAuthServicesUpdate()
+			OAuthServicesUpdate()
 
 	changed: (record) ->
 		if /^Accounts_OAuth_.+/.test record._id
-			oAuthServicesUpdate()
+			OAuthServicesUpdate()
 
 	removed: (record) ->
 		if /^Accounts_OAuth_Custom.+/.test record._id
-			oAuthServicesRemove record._id
+			OAuthServicesRemove record._id
diff --git a/packages/rocketchat-lib/server/startup/settings.coffee b/packages/rocketchat-lib/server/startup/settings.coffee
index f085d669fad..14d790763ee 100644
--- a/packages/rocketchat-lib/server/startup/settings.coffee
+++ b/packages/rocketchat-lib/server/startup/settings.coffee
@@ -31,7 +31,7 @@ RocketChat.settings.addGroup 'Accounts', ->
 		@add 'Accounts_AvatarStoreType', 'GridFS', { type: 'select', values: [ { key: 'GridFS', i18nLabel: 'GridFS' }, { key: 'FileSystem', i18nLabel: 'FileSystem' } ] }
 		@add 'Accounts_AvatarStorePath', '', { type: 'string', enableQuery: {_id: 'Accounts_AvatarStoreType', value: 'FileSystem'} }
 
-RocketChat.settings.addGroup 'oAuth', ->
+RocketChat.settings.addGroup 'OAuth', ->
 
 	@section 'Facebook', ->
 		@add 'Accounts_OAuth_Facebook', false, { type: 'boolean', public: true }
diff --git a/packages/rocketchat-wordpress/startup.coffee b/packages/rocketchat-wordpress/startup.coffee
index 1386cc1c024..d52d82dadf4 100644
--- a/packages/rocketchat-wordpress/startup.coffee
+++ b/packages/rocketchat-wordpress/startup.coffee
@@ -1,6 +1,9 @@
-RocketChat.settings.add 'API_Wordpress_URL', '', { type: 'string', group: 'Accounts', public: true, section: 'WordPress' }
-RocketChat.settings.add 'Accounts_OAuth_Wordpress', false, { type: 'boolean', group: 'Accounts', section: 'WordPress' }
-RocketChat.settings.add 'Accounts_OAuth_Wordpress_id', '', { type: 'string', group: 'Accounts', section: 'WordPress' }
-RocketChat.settings.add 'Accounts_OAuth_Wordpress_secret', '', { type: 'string', group: 'Accounts', section: 'WordPress' }
-RocketChat.settings.add 'Accounts_OAuth_Wordpress_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/wordpress', { type: 'string', blocked: true }
+RocketChat.settings.addGroup 'OAuth', ->
+	@section 'WordPress', ->
+		enableQuery = {_id: 'Accounts_OAuth_Wordpress', value: true}
+		@add 'Accounts_OAuth_Wordpress', false, { type: 'boolean', public: true }
+		@add 'API_Wordpress_URL', '', { type: 'string', enableQuery: enableQuery, public: true }
+		@add 'Accounts_OAuth_Wordpress_id', '', { type: 'string', enableQuery: enableQuery }
+		@add 'Accounts_OAuth_Wordpress_secret', '', { type: 'string', enableQuery: enableQuery }
+		@add 'Accounts_OAuth_Wordpress_callback_url', __meteor_runtime_config__?.ROOT_URL + '_oauth/wordpress', { type: 'string', blocked: true }
 
diff --git a/server/configuration/accounts_meld.coffee b/server/configuration/accounts_meld.coffee
index 69680727cbf..ab4ac6ab5ef 100644
--- a/server/configuration/accounts_meld.coffee
+++ b/server/configuration/accounts_meld.coffee
@@ -1,7 +1,7 @@
 orig_updateOrCreateUserFromExternalService = Accounts.updateOrCreateUserFromExternalService
 Accounts.updateOrCreateUserFromExternalService = (serviceName, serviceData, options) ->
 
-	if serviceName not in ['facebook', 'github', 'gitlab', 'google', 'meteor-developer', 'linkedin', 'twitter', 'sandstorm'] and serviceData._oAuthCustom isnt true
+	if serviceName not in ['facebook', 'github', 'gitlab', 'google', 'meteor-developer', 'linkedin', 'twitter', 'sandstorm'] and serviceData._OAuthCustom isnt true
 		return
 
 	if serviceName is 'meteor-developer'
-- 
GitLab