Skip to content
Snippets Groups Projects
Unverified Commit a9956c04 authored by Martin Schoeler's avatar Martin Schoeler Committed by GitHub
Browse files

refactor: remove meteor from drupal auth (#34991)

parent c5681009
No related merge requests found
import type { OauthConfig } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../custom-oauth/client/CustomOAuth';
import { settings } from '../../settings/client';
import { CustomOAuth } from '../../../custom-oauth/client/CustomOAuth';
// Drupal Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/drupal
// In RocketChat -> Administration the URL needs to be http(s)://{drupal.server}/
......@@ -26,11 +25,13 @@ const config: OauthConfig = {
const Drupal = new CustomOAuth('drupal', config);
Meteor.startup(() => {
Tracker.autorun(() => {
if (settings.get('API_Drupal_URL')) {
config.serverURL = settings.get('API_Drupal_URL');
export const useDrupal = () => {
const drupalUrl = useSetting('API_Drupal_URL') as string;
useEffect(() => {
if (drupalUrl) {
config.serverURL = drupalUrl;
Drupal.configure(config);
}
});
});
}, [drupalUrl]);
};
import './lib';
......@@ -5,7 +5,6 @@ import '../app/autotranslate/client';
import '../app/canned-responses/client';
import '../app/custom-sounds/client';
import '../app/dolphin/client';
import '../app/drupal/client';
import '../app/emoji/client';
import '../app/emoji-emojione/client';
import '../app/emoji-custom/client';
......
......@@ -7,6 +7,7 @@ import { useGoogleTagManager } from './hooks/useGoogleTagManager';
import { useMessageLinkClicks } from './hooks/useMessageLinkClicks';
import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl';
import { useAnalytics } from '../../../app/analytics/client/loadScript';
import { useDrupal } from '../../../app/drupal/client/hooks/useDrupal';
import { useGitHubEnterpriseAuth } from '../../../app/github-enterprise/client/hooks/useGitHubEnterpriseAuth';
import { useGitLabAuth } from '../../../app/gitlab/client/hooks/useGitLabAuth';
import { useLivechatEnterprise } from '../../../app/livechat-enterprise/hooks/useLivechatEnterprise';
......@@ -39,6 +40,7 @@ const AppLayout = () => {
useNextcloud();
useGitLabAuth();
useGitHubEnterpriseAuth();
useDrupal();
const layout = useSyncExternalStore(appLayout.subscribe, appLayout.getSnapshot);
......
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