Skip to content

Commit a9956c0

Browse files
refactor: remove meteor from drupal auth (#34991)
Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com>
1 parent c568100 commit a9956c0

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

apps/meteor/app/drupal/client/lib.ts renamed to apps/meteor/app/drupal/client/hooks/useDrupal.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import type { OauthConfig } from '@rocket.chat/core-typings';
2-
import { Meteor } from 'meteor/meteor';
3-
import { Tracker } from 'meteor/tracker';
2+
import { useSetting } from '@rocket.chat/ui-contexts';
3+
import { useEffect } from 'react';
44

5-
import { CustomOAuth } from '../../custom-oauth/client/CustomOAuth';
6-
import { settings } from '../../settings/client';
5+
import { CustomOAuth } from '../../../custom-oauth/client/CustomOAuth';
76

87
// Drupal Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/drupal
98
// In RocketChat -> Administration the URL needs to be http(s)://{drupal.server}/
@@ -26,11 +25,13 @@ const config: OauthConfig = {
2625

2726
const Drupal = new CustomOAuth('drupal', config);
2827

29-
Meteor.startup(() => {
30-
Tracker.autorun(() => {
31-
if (settings.get('API_Drupal_URL')) {
32-
config.serverURL = settings.get('API_Drupal_URL');
28+
export const useDrupal = () => {
29+
const drupalUrl = useSetting('API_Drupal_URL') as string;
30+
31+
useEffect(() => {
32+
if (drupalUrl) {
33+
config.serverURL = drupalUrl;
3334
Drupal.configure(config);
3435
}
35-
});
36-
});
36+
}, [drupalUrl]);
37+
};

apps/meteor/app/drupal/client/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/meteor/client/importPackages.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import '../app/autotranslate/client';
55
import '../app/canned-responses/client';
66
import '../app/custom-sounds/client';
77
import '../app/dolphin/client';
8-
import '../app/drupal/client';
98
import '../app/emoji/client';
109
import '../app/emoji-emojione/client';
1110
import '../app/emoji-custom/client';

apps/meteor/client/views/root/AppLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useGoogleTagManager } from './hooks/useGoogleTagManager';
77
import { useMessageLinkClicks } from './hooks/useMessageLinkClicks';
88
import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl';
99
import { useAnalytics } from '../../../app/analytics/client/loadScript';
10+
import { useDrupal } from '../../../app/drupal/client/hooks/useDrupal';
1011
import { useGitHubEnterpriseAuth } from '../../../app/github-enterprise/client/hooks/useGitHubEnterpriseAuth';
1112
import { useGitLabAuth } from '../../../app/gitlab/client/hooks/useGitLabAuth';
1213
import { useLivechatEnterprise } from '../../../app/livechat-enterprise/hooks/useLivechatEnterprise';
@@ -39,6 +40,7 @@ const AppLayout = () => {
3940
useNextcloud();
4041
useGitLabAuth();
4142
useGitHubEnterpriseAuth();
43+
useDrupal();
4244

4345
const layout = useSyncExternalStore(appLayout.subscribe, appLayout.getSnapshot);
4446

0 commit comments

Comments
 (0)