Add standalone chat with ability to send messages (#1270)
* properly pass the messagesOnly to chat * use actual username if embed is not messageonly * mv embed chat to chat-overlay * add new embed chat page * fix router * secure random number for non-secure application! * add chat enable/disable functionality * add username form add customStyles * mv overlay css * add style for embed chat style cleanup * rm username form from chat overlay * refactoring * css cleanup css adjust * minor cleanup * mark the embed chats as readonly and readwrite * replace 301 redirects with 307 * add redirect for the cached address * set insatnce name in chat
This commit is contained in:
@@ -55,7 +55,7 @@ export default class Chat extends Component {
|
||||
|
||||
window.addEventListener('resize', this.handleWindowResize);
|
||||
|
||||
if (!this.props.messagesOnly) {
|
||||
if (!this.props.readonly) {
|
||||
window.addEventListener('blur', this.handleWindowBlur);
|
||||
window.addEventListener('focus', this.handleWindowFocus);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export default class Chat extends Component {
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener('resize', this.handleWindowResize);
|
||||
if (!this.props.messagesOnly) {
|
||||
if (!this.props.readonly) {
|
||||
window.removeEventListener('blur', this.handleWindowBlur);
|
||||
window.removeEventListener('focus', this.handleWindowFocus);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ export default class Chat extends Component {
|
||||
visible: messageVisible,
|
||||
} = message;
|
||||
const { messages: curMessages } = this.state;
|
||||
const { username, messagesOnly } = this.props;
|
||||
const { username, readonly } = this.props;
|
||||
|
||||
const existingIndex = curMessages.findIndex(
|
||||
(item) => item.id === messageId
|
||||
@@ -236,7 +236,7 @@ export default class Chat extends Component {
|
||||
}
|
||||
|
||||
// if window is blurred and we get a new message, add 1 to title
|
||||
if (!messagesOnly && messageType === 'CHAT' && this.windowBlurred) {
|
||||
if (!readonly && messageType === 'CHAT' && this.windowBlurred) {
|
||||
this.numMessagesSinceBlur += 1;
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ export default class Chat extends Component {
|
||||
// update document title if window blurred
|
||||
if (
|
||||
this.numMessagesSinceBlur &&
|
||||
!this.props.messagesOnly &&
|
||||
!this.props.readonly &&
|
||||
this.windowBlurred
|
||||
) {
|
||||
this.updateDocumentTitle();
|
||||
@@ -348,7 +348,7 @@ export default class Chat extends Component {
|
||||
}
|
||||
|
||||
render(props, state) {
|
||||
const { username, messagesOnly, chatInputEnabled, inputMaxBytes } = props;
|
||||
const { username, readonly, chatInputEnabled, inputMaxBytes } = props;
|
||||
const { messages, chatUserNames, webSocketConnected } = state;
|
||||
|
||||
const messageList = messages
|
||||
@@ -362,7 +362,7 @@ export default class Chat extends Component {
|
||||
/>`
|
||||
);
|
||||
|
||||
if (messagesOnly) {
|
||||
if (readonly) {
|
||||
return html`
|
||||
<div
|
||||
id="messages-container"
|
||||
|
||||
Reference in New Issue
Block a user