[deploy] Small connect js fixes (#7350)
This commit is contained in:
parent
697c0df5b1
commit
2d978696c4
3 changed files with 13 additions and 6 deletions
|
|
@ -55,10 +55,6 @@ function fetchNotificationsCount() {
|
|||
document.getElementById('notifications-link').href,
|
||||
'force',
|
||||
);
|
||||
InstantClick.preload(
|
||||
document.getElementById('connect-link').href,
|
||||
'force',
|
||||
);
|
||||
}, 30);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -406,6 +406,11 @@ export default class Chat extends Component {
|
|||
unopenedChannelIds,
|
||||
} = this.state;
|
||||
const receivedChatChannelId = message.chat_channel_id;
|
||||
const messageList = document.getElementById('messagelist')
|
||||
const nearBottom = (messageList.scrollTop + messageList.offsetHeight + 400 > messageList.scrollHeight)
|
||||
if (nearBottom) {
|
||||
scrollToBottom();
|
||||
}
|
||||
let newMessages = [];
|
||||
if (
|
||||
message.temp_id &&
|
||||
|
|
@ -424,7 +429,7 @@ export default class Chat extends Component {
|
|||
}
|
||||
}
|
||||
const newShowAlert =
|
||||
activeChannelId === receivedChatChannelId ? { showAlert: scrolled } : {};
|
||||
activeChannelId === receivedChatChannelId ? { showAlert: !nearBottom } : {};
|
||||
let newMessageChannelIndex = 0;
|
||||
let newMessageChannel = null;
|
||||
const newChannelsObj = chatChannels.map((channel, index) => {
|
||||
|
|
@ -597,7 +602,7 @@ export default class Chat extends Component {
|
|||
};
|
||||
|
||||
handleMessageSubmit = (message) => {
|
||||
const { activeChannelId, activeContent } = this.state;
|
||||
const { activeChannelId } = this.state;
|
||||
scrollToBottom();
|
||||
// should check if user has the privilege
|
||||
if (message.startsWith('/code')) {
|
||||
|
|
@ -658,6 +663,7 @@ export default class Chat extends Component {
|
|||
message,
|
||||
mentionedUsersId: this.getMentionedUsers(message),
|
||||
};
|
||||
this.setState({scrolled: false, showAlert: false})
|
||||
sendMessage(messageObject, this.handleSuccess, this.handleFailure);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ class UnopenedChannelNotice extends Component {
|
|||
if (unopenedChannels.length > 0) {
|
||||
number.classList.remove('hidden');
|
||||
number.innerHTML = unopenedChannels.length;
|
||||
document.getElementById('connect-link').href = '/connect/' + unopenedChannels[0].adjusted_slug;
|
||||
InstantClick.preload(
|
||||
document.getElementById('connect-link').href,
|
||||
'force',
|
||||
);
|
||||
} else {
|
||||
number.classList.add('hidden');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue