Skip to content

Commit 8e33fc3

Browse files
committed
Add metadata getter and setter in the ychat
1 parent 3c7b088 commit 8e33fc3

File tree

2 files changed

+11
-1
lines changed
  • packages/jupyterlab-collaborative-chat/src
  • python/jupyterlab-collaborative-chat/jupyterlab_collaborative_chat

2 files changed

+11
-1
lines changed

packages/jupyterlab-collaborative-chat/src/ychat.ts

+10
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ export class YChat extends YDocument<IChatChanges> {
137137
});
138138
}
139139

140+
getMetadata(key: string): IMetadata | undefined {
141+
return this._metadata.get(key);
142+
}
143+
144+
setMetadata(key: string, value: PartialJSONValue) {
145+
this.transact(() => {
146+
this._metadata.set(key, value);
147+
});
148+
}
149+
140150
private _usersObserver = (event: Y.YMapEvent<IUser>): void => {
141151
const userChange = new Array<UserChange>();
142152
event.keysChanged.forEach(key => {

python/jupyterlab-collaborative-chat/jupyterlab_collaborative_chat/ychat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def get_metadata(self) -> dict[str, dict]:
149149
"""
150150
return self._ymetadata.to_py()
151151

152-
def set_metadata(self, name: str, metadata: dict):
152+
def set_metadata(self, name: str, metadata: Any):
153153
"""
154154
Adds or modifies a metadata of the document.
155155
"""

0 commit comments

Comments
 (0)