diff --git a/jupyter_collaboration/__init__.py b/jupyter_collaboration/__init__.py index b93a0ce5..b8324675 100644 --- a/jupyter_collaboration/__init__.py +++ b/jupyter_collaboration/__init__.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List from ._version import __version__ # noqa -from .app import CollaborativeChatExtension, YDocExtension +from .app import YDocExtension def _jupyter_labextension_paths(): return [{"src": "labextension", "dest": "@jupyter/collaboration-extension"}] @@ -13,5 +13,4 @@ def _jupyter_labextension_paths(): def _jupyter_server_extension_points() -> List[Dict[str, Any]]: return [ {"module": "jupyter_collaboration", "app": YDocExtension}, - {"module": "jupyter_chat", "app": CollaborativeChatExtension}, ] diff --git a/jupyter_collaboration/app.py b/jupyter_collaboration/app.py index 751f9da3..27c78a6c 100644 --- a/jupyter_collaboration/app.py +++ b/jupyter_collaboration/app.py @@ -7,10 +7,8 @@ from jupyter_server.extension.application import ExtensionApp from pycrdt_websocket.ystore import BaseYStore from traitlets import Bool, Float, Type -from jupyter_chat import ChatExtension -from jupyter_chat.handlers import GlobalConfigHandler, ChatHistoryHandler -from .handlers import CollaborativeChatHandler, DocSessionHandler, YDocWebSocketHandler +from .handlers import DocSessionHandler, YDocWebSocketHandler from .loaders import FileLoaderMapping from .stores import SQLiteYStore from .utils import EVENTS_SCHEMA_PATH @@ -122,15 +120,3 @@ async def stop_extension(self): ], timeout=3, ) - - -class CollaborativeChatExtension(ChatExtension): - - def initialize_handlers(self): - self.handlers.extend([ - (fr"{self.base_url}?", CollaborativeChatHandler), - (fr"{self.base_url}config/?", GlobalConfigHandler), - (fr"{self.base_url}history/?", ChatHistoryHandler) - ]) - - self.log.debug("Collaborative Chat Handlers initialized") diff --git a/jupyter_collaboration/handlers.py b/jupyter_collaboration/handlers.py index ea12cd7d..c345d01b 100644 --- a/jupyter_collaboration/handlers.py +++ b/jupyter_collaboration/handlers.py @@ -384,25 +384,3 @@ async def put(self, path): ) self.set_status(201) return self.finish(data) - - -class CollaborativeChatHandler(ChatHandler): - - def get_chat_user(self) -> ChatUser: - """Retrieves the current user from collaborative context.""" - - names = self.current_user.name.split(" ", maxsplit=2) - initials = getattr(self.current_user, "initials", None) - if not initials: - # compute default initials in case IdentityProvider doesn't - # return initials, e.g. JupyterHub (#302) - names = self.current_user.name.split(" ", maxsplit=2) - initials = "".join( - [(name.capitalize()[0] if len(name) > 0 else "") for name in names] - ) - chat_user_kwargs = { - **asdict(self.current_user), - "initials": initials, - } - - return ChatUser(**chat_user_kwargs)