[deploy] Add functionality to /connect (#7264)
This commit is contained in:
parent
7103b406ad
commit
dc76277f0d
1 changed files with 27 additions and 1 deletions
|
|
@ -560,7 +560,8 @@ export default class Chat extends Component {
|
|||
};
|
||||
|
||||
handleMessageSubmit = (message) => {
|
||||
const { activeChannelId } = this.state;
|
||||
const { activeChannelId, activeContent } = this.state;
|
||||
scrollToBottom();
|
||||
// should check if user has the privilege
|
||||
if (message.startsWith('/code')) {
|
||||
this.setActiveContentState(activeChannelId, { type_of: 'code_editor' });
|
||||
|
|
@ -580,6 +581,30 @@ export default class Chat extends Component {
|
|||
path: '/new',
|
||||
type_of: 'article',
|
||||
});
|
||||
} else if (message.startsWith('/search')) {
|
||||
this.setActiveContentState(activeChannelId, {
|
||||
type_of: 'loading-post',
|
||||
});
|
||||
this.setActiveContent({
|
||||
path: '/search?q=' + message.replace('/search ', ''),
|
||||
type_of: 'article',
|
||||
});
|
||||
} else if (message.startsWith('/s ')) {
|
||||
this.setActiveContentState(activeChannelId, {
|
||||
type_of: 'loading-post',
|
||||
});
|
||||
this.setActiveContent({
|
||||
path: '/search?q=' + message.replace('/s ', ''),
|
||||
type_of: 'article',
|
||||
});
|
||||
} else if (message.startsWith('/')) {
|
||||
this.setActiveContentState(activeChannelId, {
|
||||
type_of: 'loading-post',
|
||||
});
|
||||
this.setActiveContent({
|
||||
path: message,
|
||||
type_of: 'article',
|
||||
});
|
||||
} else if (message.startsWith('/github')) {
|
||||
const args = message.split('/github ')[1].trim();
|
||||
this.setActiveContentState(activeChannelId, { type_of: 'github', args });
|
||||
|
|
@ -691,6 +716,7 @@ export default class Chat extends Component {
|
|||
|
||||
handleSuccess = (response) => {
|
||||
const { activeChannelId } = this.state;
|
||||
scrollToBottom();
|
||||
if (response.status === 'success') {
|
||||
if (response.message.temp_id) {
|
||||
this.setState(({ messages }) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue