diff --git a/chat/consumers.py b/chat/consumers.py index 671d1c74..23dd9e9b 100644 --- a/chat/consumers.py +++ b/chat/consumers.py @@ -49,16 +49,8 @@ class ChatRoomConsumer(AsyncWebsocketConsumer): message = event["message"] nick = event["nick"] - # Insert a white space in words longer than 22 characters. - # Helps when messages overflow in a single line. - words = message.split(" ") - fix_message = "" - for word in words: - word = " ".join(word[i:i + 22] for i in range(0, len(word), 22)) - fix_message = fix_message + " " + word - await self.send(text_data=json.dumps({ - "message": fix_message, + "message": message, "user_nick": nick, })) diff --git a/docker-compose.yml b/docker-compose.yml index d6bf52ee..c60bfd32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,6 +37,7 @@ services: command: python3 manage.py clean_orders volumes: - .:/usr/src/robosats + - /mnt/development/lnd:/lnd network_mode: service:tor follow-invoices: @@ -71,7 +72,6 @@ services: REDIS_URL: redis://localhost:6379 volumes: - .:/usr/src/robosats - - /mnt/development/database:/usr/src/database network_mode: service:tor tor: diff --git a/frontend/src/components/Chat.js b/frontend/src/components/Chat.js index 16cf2c71..6bfdfdc9 100644 --- a/frontend/src/components/Chat.js +++ b/frontend/src/components/Chat.js @@ -48,12 +48,14 @@ export default class Chat extends Component { } onButtonClicked = (e) => { - this.client.send(JSON.stringify({ - type: "message", - message: this.state.value, - nick: this.props.ur_nick, - })); - this.state.value = '' + if(this.state.value!=''){ + this.client.send(JSON.stringify({ + type: "message", + message: this.state.value, + nick: this.props.ur_nick, + })); + this.state.value = '' + } e.preventDefault(); } @@ -65,7 +67,7 @@ export default class Chat extends Component { {/* If message sender is not our nick, gray color, if it is our nick, green color */} {message.userNick == this.props.ur_nick ? - : - } - style={{backgroundColor: '#fcfcfc'}} - title={message.userNick} - subheader={message.msg} - />} + avatar={ + + } + style={{backgroundColor: '#fcfcfc'}} + title={message.userNick} + subheader={message.msg} + subheaderTypographyProps={{sx: {wordWrap: "break-word", width: 200}}} + />} >)}