Skip to content

Commit

Permalink
ui/chat cannot know about relay and hardcode its separator
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jul 7, 2024
1 parent 0031e1d commit 4c8aced
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions ui/analyse/src/study/relay/chatHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function broadcastChatHandler(ctrl: AnalyseCtrl): BroadcastChatHandler {
const separator = '\ue666';

const encodeMsg = (text: string): string => {
text = cleanMsg(text);
if (ctrl.study?.relay && !ctrl.study.relay.tourShow()) {
const chapterId = ctrl.study.currentChapter().id;
const ply = ctrl.study.currentNode().ply;
Expand Down
2 changes: 0 additions & 2 deletions ui/chat/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ export default class ChatCtrl {
alert('Max length: 140 chars. ' + text.length + ' chars used.');
return false;
}
if (text.includes('\ue666')) return false;

if (this.broadcastChatHandler) text = this.broadcastChatHandler.encodeMsg(text);

site.pubsub.emit('socket.send', 'talk', text);
Expand Down
2 changes: 1 addition & 1 deletion ui/chat/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface Line {
}

export interface BroadcastChatHandler {
encodeMsg(text: string): string;
encodeMsg(msg: string): string;
cleanMsg(msg: string): string;
jumpToMove(msg: string): void;
canJumpToMove(msg: string): string | null;
Expand Down

0 comments on commit 4c8aced

Please sign in to comment.