Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function buildBuilder(
) {
const built = { setVisible: vi.fn() };
const builder: Record<string, unknown> = {};
builder.setAppId = vi.fn().mockReturnValue(builder);
builder.setOAuthToken = vi.fn().mockReturnValue(builder);
builder.setDeveloperKey = vi.fn().mockReturnValue(builder);
builder.addView = vi.fn().mockReturnValue(builder);
Expand Down Expand Up @@ -153,5 +154,16 @@ describe('useGooglePicker', () => {
/access_denied/
);
});

it('calls setAppId with the project number derived from the client id', async () => {
process.env.REACT_APP_GOOGLE_CLIENT_ID =
'806855830059-abc123def.apps.googleusercontent.com';
const { builder } = stubGoogle((cb) => {
queueMicrotask(() => cb({ action: 'cancel' }));
});
const { result } = renderHook(() => useGooglePicker());
await result.current.openPicker();
expect(builder.setAppId).toHaveBeenCalledWith('806855830059');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface PickerBuilder {
setDeveloperKey: (key: string) => PickerBuilder;
setCallback: (cb: (data: PickerCallbackData) => void) => PickerBuilder;
addView: (view: unknown) => PickerBuilder;
setAppId?: (id: string) => PickerBuilder;
setAppId: (id: string) => PickerBuilder;
build: () => { setVisible: (visible: boolean) => void };
}

Expand Down Expand Up @@ -204,6 +204,8 @@ export function useGooglePicker() {
}
inFlightRef.current = true;

const projectNumber = id.split('-')[0];

return Promise.all([loadPicker(), loadIdentityServices()])
.then(
([picker, oauth2]) =>
Expand All @@ -223,6 +225,7 @@ export function useGooglePicker() {
const view = new picker.DocsView();
view.setIncludeFolders(false);
const built = new picker.PickerBuilder()
.setAppId(projectNumber)
.setOAuthToken(resp.access_token)
.setDeveloperKey(key)
.addView(view)
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/WhatsNewPage/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ChangelogEntry {
}

export const changelog: ChangelogEntry[] = [
{ type: 'fix', title: 'Upload form: Google Drive picks convert into decks instead of erroring', date: '2026-05-16' },
{ type: 'feature', title: 'Upload form: pick a file from Google Drive in one click', date: '2026-05-16' },
{ type: 'feature', title: 'From Google Drive section on Downloads — see the files you picked from Drive and open any of them with one click', date: '2026-05-16' },
{ type: 'style', title: 'Upload form has tabs — Your computer and Dropbox sit side by side at the top of the page', date: '2026-05-15' },
Expand Down