Add safe navigation within chatchannelmemberships and remove some console.logs (#2903)
This commit is contained in:
parent
a0ca7c9f45
commit
ec900a3146
6 changed files with 4 additions and 16 deletions
|
|
@ -51,11 +51,7 @@ describe('<ArticleForm />', () => {
|
|||
'editor-v2-http://localhost/',
|
||||
JSON.stringify({ bodyMarkdown: 'hello, world' }),
|
||||
);
|
||||
console.log(localStorage)
|
||||
const form = shallow(getArticleForm());
|
||||
console.log("&&&&&")
|
||||
console.log(form.state())
|
||||
console.log(form.state().bodyMarkdown)
|
||||
expect(form.state().bodyMarkdown).toBe('hello, world');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ export default class Article extends Component {
|
|||
handleReactionClick = e => {
|
||||
e.preventDefault();
|
||||
const { target } = e;
|
||||
console.log(target.dataset.category);
|
||||
this.setState({ optimisticUserReaction: target.dataset.category });
|
||||
const article = this.props.resource;
|
||||
fetch('/reactions', {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ class ChannelDetails extends Component {
|
|||
|
||||
triggerLeaveChannel = e => {
|
||||
e.preventDefault();
|
||||
console.log(e)
|
||||
const id = e.target.dataset.content;
|
||||
fetch(`/chat_channel_memberships/${id}`, {
|
||||
method: 'DELETE',
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ const Channels = ({
|
|||
channelsLoaded,
|
||||
incomingVideoCallChannelIds,
|
||||
}) => {
|
||||
console.log(incomingVideoCallChannelIds)
|
||||
const channels = chatChannels.map(channel => {
|
||||
const isActive = parseInt(activeChannelId, 10) === channel.chat_channel_id;
|
||||
const lastOpened = channel.last_opened_at;
|
||||
|
|
|
|||
|
|
@ -272,7 +272,6 @@ export default class Chat extends Component {
|
|||
|
||||
receiveNewMessage = message => {
|
||||
const receivedChatChannelId = message.chat_channel_id;
|
||||
console.log(this.state.messages)
|
||||
let newMessages = []
|
||||
if (this.state.messages[receivedChatChannelId]) {
|
||||
newMessages = this.state.messages[receivedChatChannelId].slice();
|
||||
|
|
@ -321,9 +320,6 @@ export default class Chat extends Component {
|
|||
};
|
||||
|
||||
receiveVideoCallHangup = () => {
|
||||
console.log(this.state.videoCallParticipants)
|
||||
console.log(this.state.videoCallParticipants.size)
|
||||
console.log(this.state.videoCallParticipants)
|
||||
if (this.state.videoCallParticipants.size < 1) {
|
||||
this.setState({ activeVideoChannelId: null });
|
||||
}
|
||||
|
|
@ -562,7 +558,6 @@ export default class Chat extends Component {
|
|||
};
|
||||
|
||||
setActiveContent = response => {
|
||||
console.log(response)
|
||||
const newActiveContent = this.state.activeContent;
|
||||
newActiveContent[this.state.activeChannelId] = response;
|
||||
this.setState({ activeContent: newActiveContent });
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class ChatChannelMembership < ApplicationRecord
|
|||
|
||||
def channel_name
|
||||
if chat_channel.channel_type == "direct"
|
||||
"@#{other_user.username}"
|
||||
"@#{other_user&.username}"
|
||||
else
|
||||
chat_channel.channel_name
|
||||
end
|
||||
|
|
@ -57,12 +57,12 @@ class ChatChannelMembership < ApplicationRecord
|
|||
end
|
||||
|
||||
def channel_username
|
||||
other_user.username if chat_channel.channel_type == "direct"
|
||||
other_user&.username if chat_channel.channel_type == "direct"
|
||||
end
|
||||
|
||||
def channel_color
|
||||
if chat_channel.channel_type == "direct"
|
||||
other_user.decorate.darker_color
|
||||
other_user&.decorate.darker_color
|
||||
else
|
||||
"#111111"
|
||||
end
|
||||
|
|
@ -70,7 +70,7 @@ class ChatChannelMembership < ApplicationRecord
|
|||
|
||||
def channel_modified_slug
|
||||
if chat_channel.channel_type == "direct"
|
||||
"@" + other_user.username
|
||||
"@" + other_user&.username
|
||||
else
|
||||
chat_channel.slug
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue