Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use content providers to remove RTC prefix #418

Merged
merged 14 commits into from
Jan 7, 2025
Merged
Prev Previous commit
Next Next commit
Set awareness for user regardless of RTC prefix
krassowski committed Jan 7, 2025
commit abb234b77e88cdd1c42a9605f5d4558c6d5327c3
2 changes: 1 addition & 1 deletion packages/collaboration-extension/src/collaboration.ts
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ export const rtcGlobalAwarenessPlugin: JupyterFrontEndPlugin<IAwareness> = {
const data: any = await state.toJSON();
const current: string = data['layout-restorer:data']?.main?.current || '';

if (current.match(/^\w+:RTC:/)) {
if (current.match(/^\w+:\w+/)) {
awareness.setLocalStateField('current', current);
} else {
awareness.setLocalStateField('current', null);

Unchanged files with check annotations Beta

if (
this._currentUser.isReady &&
value.user &&
value.user.username !== this._currentUser.identity!.username

Check warning on line 106 in packages/collaboration/src/collaboratorspanel.tsx

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
) {
collaborators.push(value as ICollaboratorAwareness);
}
const fileTypes = props.docRegistry
?.getFileTypesForPath(path[1])
?.filter(ft => ft.icon !== undefined);
const icon = fileTypes ? fileTypes[0].icon! : fileIcon;

Check warning on line 169 in packages/collaboration/src/collaboratorspanel.tsx

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
const iconClass: string | undefined = fileTypes
? fileTypes[0].iconClass
: undefined;
above: true,
markers(view) {
const { awareness, ytext } = view.state.facet(editorAwarenessFacet);
const ydoc = ytext.doc!;

Check warning on line 171 in packages/collaboration/src/cursors.ts

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
const cursors: LayerMarker[] = [];
awareness.getStates().forEach((state: IAwarenessState, clientID) => {
if (clientID === awareness.doc.clientID) {
const userHover = hoverTooltip(
(view, pos) => {
const { awareness, ytext } = view.state.facet(editorAwarenessFacet);
const ydoc = ytext.doc!;

Check warning on line 235 in packages/collaboration/src/cursors.ts

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
for (const [clientID, state] of awareness.getStates()) {
if (clientID === awareness.doc.clientID) {
above: false,
markers(view) {
const { awareness, ytext } = view.state.facet(editorAwarenessFacet);
const ydoc = ytext.doc!;

Check warning on line 286 in packages/collaboration/src/cursors.ts

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
const cursors: LayerMarker[] = [];
awareness.getStates().forEach((state: IAwarenessState, clientID) => {
if (clientID === awareness.doc.clientID) {
* @returns A virtual element representing the item label.
*/
private _createUserIcon(): VirtualElement {
if (this._user.isReady && this._user.identity!.avatar_url) {

Check warning on line 65 in packages/collaboration/src/menu.ts

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
return h.div(
{
className: 'lm-MenuBar-itemIcon jp-MenuBar-imageIcon'
},
h.img({ src: this._user.identity!.avatar_url })

Check warning on line 70 in packages/collaboration/src/menu.ts

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
);
} else if (this._user.isReady) {
return h.div(
{
className: 'lm-MenuBar-itemIcon jp-MenuBar-anonymousIcon',
style: { backgroundColor: this._user.identity!.color }

Check warning on line 76 in packages/collaboration/src/menu.ts

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
},
h.span({}, this._user.identity!.initials)

Check warning on line 78 in packages/collaboration/src/menu.ts

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
);
} else {
return h.div(
this._body = null;
if (this._profile.isReady) {
this._body = new UserInfoBody(this._profile.identity!);

Check warning on line 26 in packages/collaboration/src/userinfopanel.tsx

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
this.addWidget(this._body);
this.update();
} else {
await panel.locator('.jp-CollaboratorsList .jp-CollaboratorHeader').first().click();
await panel.locator('.jp-CollaboratorsList .jp-CollaboratorFiles').getByText(notebookName).click();
await expect.soft(dockTabs.locator('li')).toHaveCount(2);

Check failure on line 177 in ui-tests/tests/collaborationpanel.spec.ts

GitHub Actions / ui_tests

tests/collaborationpanel.spec.ts:150:7 › One client › clicking on collaborator should open to its current document

1) tests/collaborationpanel.spec.ts:150:7 › One client › clicking on collaborator should open to its current document Error: Timed out 5000ms waiting for expect(received).toHaveCount(expected) // deep equality Expected: 2 Received: 1 Call log: - expect.soft.toHaveCount with timeout 5000ms - waiting for locator('#jp-main-dock-panel > .lm-DockPanel-tabBar > ul').locator('li') - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" - locator resolved to 1 element - unexpected value "1" 175 | await panel.locator('.jp-CollaboratorsList .jp-CollaboratorFiles').getByText(notebookName).click(); 176 | > 177 | await expect.soft(dockTabs.locator('li')).toHaveCount(2); | ^ 178 | await expect(dockTabs.locator('li.lm-mod-current > .lm-TabBar-tabLabel')).toHaveText(notebookName); 179 | }); 180 | }); at /home/runner/work/jupyter-collaboration/jupyter-collaboration/ui-tests/tests/collaborationpanel.spec.ts:177:47
await expect(dockTabs.locator('li.lm-mod-current > .lm-TabBar-tabLabel')).toHaveText(notebookName);

Check failure on line 178 in ui-tests/tests/collaborationpanel.spec.ts

GitHub Actions / ui_tests

tests/collaborationpanel.spec.ts:150:7 › One client › clicking on collaborator should open to its current document

1) tests/collaborationpanel.spec.ts:150:7 › One client › clicking on collaborator should open to its current document Error: Timed out 5000ms waiting for expect(received).toHaveText(expected) Expected string: "Untitled.ipynb" Received string: "Launcher" Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('#jp-main-dock-panel > .lm-DockPanel-tabBar > ul').locator('li.lm-mod-current > .lm-TabBar-tabLabel') - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" - locator resolved to <div class="lm-TabBar-tabLabel">Launcher</div> - unexpected value "Launcher" 176 | 177 | await expect.soft(dockTabs.locator('li')).toHaveCount(2); > 178 | await expect(dockTabs.locator('li.lm-mod-current > .lm-TabBar-tabLabel')).toHaveText(notebookName); | ^ 179 | }); 180 | }); 181 | at /home/runner/work/jupyter-collaboration/jupyter-collaboration/ui-tests/tests/collaborationpanel.spec.ts:178:79
});
});