Skip to content

Commit

Permalink
Add metadata getter and setter in the ychat
Browse files Browse the repository at this point in the history
  • Loading branch information
brichet committed Nov 8, 2024
1 parent 72598e2 commit 90aab6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/jupyterlab-collaborative-chat/src/ychat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ export class YChat extends YDocument<IChatChanges> {
});
}

getMetadata(key: string): IMetadata | undefined {
return this._metadata.get(key);
}

setMetadata(key: string, value: PartialJSONValue) {
this.transact(() => {
this._metadata.set(key, value);
});
}

private _usersObserver = (event: Y.YMapEvent<IUser>): void => {
const userChange = new Array<UserChange>();
event.keysChanged.forEach(key => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def get_metadata(self) -> dict[str, dict]:
"""
return self._ymetadata.to_py()

def set_metadata(self, name: str, metadata: dict):
def set_metadata(self, name: str, metadata: Any):
"""
Adds or modifies a metadata of the document.
"""
Expand Down

0 comments on commit 90aab6d

Please sign in to comment.