Add ability to open /new in connect sidecar (#5220) [deploy]

This commit is contained in:
Ben Halpern 2019-12-23 09:11:02 -05:00 committed by GitHub
parent bb570a2d55
commit 737310f8ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -523,6 +523,14 @@ export default class Chat extends Component {
.trigger('client-initiatevideocall', {
channelId: activeChannelId,
});
} else if (message.startsWith('/new')) {
this.setActiveContentState(activeChannelId, {
type_of: 'loading-post',
});
this.setActiveContent({
path: '/new',
type_of: 'article'
})
} else if (message.startsWith('/github')) {
const args = message.split('/github ')[1].trim();
this.setActiveContentState(activeChannelId, { type_of: 'github', args });

View file

@ -149,6 +149,10 @@ function manageChannel(json) {
}
export default function getUnopenedChannels() {
if (window.frameElement) {
// We don't want this triggered within context of iframe.
return;
}
render(
<UnopenedChannelNotice
unopenedChannels={[]}

View file

@ -52,12 +52,12 @@ class Message < ApplicationRecord
doc = Nokogiri::HTML(html)
doc.css("a").each do |anchor|
if article = rich_link_article(anchor)
html += "<a href='#{article.path}'
html += "<a href='#{article.current_state_path}'
class='chatchannels__richlink'
target='_blank' data-content='sidecar-article'>
#{"<div class='chatchannels__richlinkmainimage' style='background-image:url(" + cl_path(article.main_image) + ")' data-content='sidecar-article' ></div>" if article.main_image.present?}
<h1 data-content='sidecar-article'>#{article.title}</h1>
<h4 data-content='sidecar-article'><img src='#{ProfileImage.new(article.cached_user).get(90)}' /> #{article.cached_user.name}#{article.readable_publish_date}</h4>
<h4 data-content='sidecar-article'><img src='#{ProfileImage.new(article.cached_user).get(90)}' /> #{article.cached_user.name}#{article.readable_publish_date || 'Draft Post'}</h4>
</a>".html_safe
elsif tag = rich_link_tag(anchor)
html += "<a href='/t/#{tag.name}'