Skip to content

Commit

Permalink
refactor: remove meteor from drupal auth (#34991)
Browse files Browse the repository at this point in the history
Co-authored-by: Douglas Fabris <[email protected]>
  • Loading branch information
MartinSchoeler and dougfabris authored Feb 14, 2025
1 parent c568100 commit a9956c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
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}/
Expand All @@ -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]);
};
1 change: 0 additions & 1 deletion apps/meteor/app/drupal/client/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/meteor/client/importPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 2 additions & 0 deletions apps/meteor/client/views/root/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -39,6 +40,7 @@ const AppLayout = () => {
useNextcloud();
useGitLabAuth();
useGitHubEnterpriseAuth();
useDrupal();

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

Expand Down

0 comments on commit a9956c0

Please sign in to comment.