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:
Nate Kelley 2025-09-25 15:24:03 -06:00 committed by GitHub
commit a8c6b1ad00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 61 additions and 4 deletions

View File

@ -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;
}
});
});
},

View File

@ -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 (

View File

@ -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);

View File

@ -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
);

View File

@ -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');
});
});