mirror of https://github.com/buster-so/buster.git
Merge pull request #1153 from buster-so/big-nate-bus-1948-cannot-click-share-menu-options
add workspace sharing to chat dropdown
This commit is contained in:
commit
a8c6b1ad00
|
@ -410,6 +410,7 @@ export const useUpdateChatShare = () => {
|
|||
const queryKey = chatQueryKeys.chatsGetChat(variables.id).queryKey;
|
||||
queryClient.setQueryData(queryKey, (previousData: IBusterChat | undefined) => {
|
||||
if (!previousData) return previousData;
|
||||
|
||||
return create(previousData, (draft: IBusterChat) => {
|
||||
draft.individual_permissions = (
|
||||
draft.individual_permissions?.map((t) => {
|
||||
|
@ -428,6 +429,10 @@ export const useUpdateChatShare = () => {
|
|||
if (variables.params.public_expiry_date !== undefined) {
|
||||
draft.public_expiry_date = variables.params.public_expiry_date;
|
||||
}
|
||||
if (variables.params.workspace_sharing !== undefined) {
|
||||
draft.workspace_sharing = variables.params.workspace_sharing;
|
||||
s;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -49,7 +49,11 @@ export const ShareMenuInvite: React.FC<ShareMenuInviteProps> = React.memo(
|
|||
|
||||
const disableSubmit = !inputHasText(inputValue) || !isValidEmail(inputValue);
|
||||
const isInviting =
|
||||
isInvitingMetric || isInvitingDashboard || isInvitingCollection || isInvitingChat;
|
||||
isInvitingMetric ||
|
||||
isInvitingDashboard ||
|
||||
isInvitingCollection ||
|
||||
isInvitingChat ||
|
||||
isInvitingReport;
|
||||
|
||||
const options: SelectItem<string>[] = useMemo(() => {
|
||||
return (
|
||||
|
|
|
@ -12,8 +12,6 @@ import { timeout } from '@/lib/timeout';
|
|||
import { getShareAssetConfig, ShareMenuContent } from '../ShareMenu';
|
||||
import { CHAT_HEADER_TITLE_ID } from './ChatHeaderTitle';
|
||||
|
||||
const stablePermissionSelector = (chat: IBusterChat) => chat.permission;
|
||||
|
||||
export const useShareMenuSelectMenu = ({ chatId = '' }: { chatId: string | undefined }) => {
|
||||
const { data: shareAssetConfig } = useGetChat({ id: chatId }, { select: getShareAssetConfig });
|
||||
const isEffectiveOwner = getIsEffectiveOwner(shareAssetConfig?.permission);
|
||||
|
|
|
@ -12,7 +12,6 @@ export const createTickDates = (
|
|||
xAxisKeys: string[],
|
||||
columnLabelFormats: Record<string, ColumnLabelFormat>
|
||||
): (Date | string)[] | null => {
|
||||
console.clear();
|
||||
const xColumnLabelFormats = xAxisKeys.map(
|
||||
(key) => columnLabelFormats[key] || DEFAULT_COLUMN_LABEL_FORMAT
|
||||
);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
import type { ParsedLocation } from '@tanstack/react-router';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { createFullURL } from './index';
|
||||
|
||||
// Mock window.location.origin
|
||||
Object.defineProperty(window, 'location', {
|
||||
value: {
|
||||
origin: 'https://example.com',
|
||||
},
|
||||
writable: true,
|
||||
});
|
||||
|
||||
describe('createFullURL', () => {
|
||||
beforeEach(() => {
|
||||
// Reset window.location.origin before each test
|
||||
Object.defineProperty(window, 'location', {
|
||||
value: {
|
||||
origin: 'https://example.com',
|
||||
},
|
||||
writable: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should create full URL from string input', () => {
|
||||
// Test case: String input should be appended to window.location.origin
|
||||
// Expected: Should return the origin combined with the path string
|
||||
const path = '/dashboard/metrics';
|
||||
const result = createFullURL(path);
|
||||
|
||||
expect(result).toBe('https://example.com/dashboard/metrics');
|
||||
});
|
||||
|
||||
it('should create full URL from ParsedLocation input', () => {
|
||||
// Test case: ParsedLocation input should use the href property
|
||||
// Expected: Should return the origin combined with the ParsedLocation.href
|
||||
const mockLocation: ParsedLocation = {
|
||||
href: '/reports/123?tab=overview',
|
||||
pathname: '/reports/123',
|
||||
search: { tab: 'overview' },
|
||||
searchStr: '?tab=overview',
|
||||
state: {},
|
||||
hash: '',
|
||||
key: 'test-key',
|
||||
maskedLocation: undefined,
|
||||
} as ParsedLocation;
|
||||
|
||||
const result = createFullURL(mockLocation);
|
||||
|
||||
expect(result).toBe('https://example.com/reports/123?tab=overview');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue