First pass on fixes
This commit is contained in:
parent
5826d89b97
commit
2f3be75fc7
269 changed files with 1593 additions and 2574 deletions
|
@ -107,8 +107,8 @@ impl ChannelView {
|
|||
.find(|view| view.read(cx).channel_buffer.read(cx).remote_id(cx) == buffer_id);
|
||||
|
||||
// If this channel buffer is already open in this pane, just return it.
|
||||
if let Some(existing_view) = existing_view.clone() {
|
||||
if existing_view.read(cx).channel_buffer == channel_view.read(cx).channel_buffer
|
||||
if let Some(existing_view) = existing_view.clone()
|
||||
&& existing_view.read(cx).channel_buffer == channel_view.read(cx).channel_buffer
|
||||
{
|
||||
if let Some(link_position) = link_position {
|
||||
existing_view.update(cx, |channel_view, cx| {
|
||||
|
@ -122,12 +122,11 @@ impl ChannelView {
|
|||
}
|
||||
return existing_view;
|
||||
}
|
||||
}
|
||||
|
||||
// If the pane contained a disconnected view for this channel buffer,
|
||||
// replace that.
|
||||
if let Some(existing_item) = existing_view {
|
||||
if let Some(ix) = pane.index_for_item(&existing_item) {
|
||||
if let Some(existing_item) = existing_view
|
||||
&& let Some(ix) = pane.index_for_item(&existing_item) {
|
||||
pane.close_item_by_id(
|
||||
existing_item.entity_id(),
|
||||
SaveIntent::Skip,
|
||||
|
@ -144,7 +143,6 @@ impl ChannelView {
|
|||
cx,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(link_position) = link_position {
|
||||
channel_view.update(cx, |channel_view, cx| {
|
||||
|
@ -259,8 +257,8 @@ impl ChannelView {
|
|||
.editor
|
||||
.update(cx, |editor, cx| editor.snapshot(window, cx));
|
||||
|
||||
if let Some(outline) = snapshot.buffer_snapshot.outline(None) {
|
||||
if let Some(item) = outline
|
||||
if let Some(outline) = snapshot.buffer_snapshot.outline(None)
|
||||
&& let Some(item) = outline
|
||||
.items
|
||||
.iter()
|
||||
.find(|item| &Channel::slug(&item.text).to_lowercase() == &position)
|
||||
|
@ -279,7 +277,6 @@ impl ChannelView {
|
|||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if !first_attempt {
|
||||
return;
|
||||
|
|
|
@ -287,8 +287,8 @@ impl ChatPanel {
|
|||
}
|
||||
|
||||
fn acknowledge_last_message(&mut self, cx: &mut Context<Self>) {
|
||||
if self.active && self.is_scrolled_to_bottom {
|
||||
if let Some((chat, _)) = &self.active_chat {
|
||||
if self.active && self.is_scrolled_to_bottom
|
||||
&& let Some((chat, _)) = &self.active_chat {
|
||||
if let Some(channel_id) = self.channel_id(cx) {
|
||||
self.last_acknowledged_message_id = self
|
||||
.channel_store
|
||||
|
@ -300,7 +300,6 @@ impl ChatPanel {
|
|||
chat.acknowledge_last_message(cx);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn render_replied_to_message(
|
||||
|
@ -405,15 +404,14 @@ impl ChatPanel {
|
|||
&& last_message.id != this_message.id
|
||||
&& duration_since_last_message < Duration::from_secs(5 * 60);
|
||||
|
||||
if let ChannelMessageId::Saved(id) = this_message.id {
|
||||
if this_message
|
||||
if let ChannelMessageId::Saved(id) = this_message.id
|
||||
&& this_message
|
||||
.mentions
|
||||
.iter()
|
||||
.any(|(_, user_id)| Some(*user_id) == self.client.user_id())
|
||||
{
|
||||
active_chat.acknowledge_message(id);
|
||||
}
|
||||
}
|
||||
|
||||
(this_message, is_continuation_from_previous, is_admin)
|
||||
});
|
||||
|
@ -871,8 +869,8 @@ impl ChatPanel {
|
|||
scroll_to_message_id.or(this.last_acknowledged_message_id)
|
||||
})?;
|
||||
|
||||
if let Some(message_id) = scroll_to_message_id {
|
||||
if let Some(item_ix) =
|
||||
if let Some(message_id) = scroll_to_message_id
|
||||
&& let Some(item_ix) =
|
||||
ChannelChat::load_history_since_message(chat.clone(), message_id, cx.clone())
|
||||
.await
|
||||
{
|
||||
|
@ -899,7 +897,6 @@ impl ChatPanel {
|
|||
}
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
})
|
||||
|
|
|
@ -241,8 +241,7 @@ impl MessageEditor {
|
|||
) -> Task<Result<Vec<CompletionResponse>>> {
|
||||
if let Some((start_anchor, query, candidates)) =
|
||||
self.collect_mention_candidates(buffer, end_anchor, cx)
|
||||
{
|
||||
if !candidates.is_empty() {
|
||||
&& !candidates.is_empty() {
|
||||
return cx.spawn(async move |_, cx| {
|
||||
let completion_response = Self::completions_for_candidates(
|
||||
cx,
|
||||
|
@ -255,12 +254,10 @@ impl MessageEditor {
|
|||
Ok(vec![completion_response])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((start_anchor, query, candidates)) =
|
||||
self.collect_emoji_candidates(buffer, end_anchor, cx)
|
||||
{
|
||||
if !candidates.is_empty() {
|
||||
&& !candidates.is_empty() {
|
||||
return cx.spawn(async move |_, cx| {
|
||||
let completion_response = Self::completions_for_candidates(
|
||||
cx,
|
||||
|
@ -273,7 +270,6 @@ impl MessageEditor {
|
|||
Ok(vec![completion_response])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Task::ready(Ok(vec![CompletionResponse {
|
||||
completions: Vec::new(),
|
||||
|
@ -474,8 +470,8 @@ impl MessageEditor {
|
|||
for range in ranges {
|
||||
text.clear();
|
||||
text.extend(buffer.text_for_range(range.clone()));
|
||||
if let Some(username) = text.strip_prefix('@') {
|
||||
if let Some(user) = this
|
||||
if let Some(username) = text.strip_prefix('@')
|
||||
&& let Some(user) = this
|
||||
.user_store
|
||||
.read(cx)
|
||||
.cached_user_by_github_login(username)
|
||||
|
@ -486,7 +482,6 @@ impl MessageEditor {
|
|||
mentioned_user_ids.push(user.id);
|
||||
anchor_ranges.push(start..end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editor.clear_highlights::<Self>(cx);
|
||||
|
|
|
@ -311,11 +311,10 @@ impl CollabPanel {
|
|||
window,
|
||||
|this: &mut Self, _, event, window, cx| {
|
||||
if let editor::EditorEvent::Blurred = event {
|
||||
if let Some(state) = &this.channel_editing_state {
|
||||
if state.pending_name().is_some() {
|
||||
if let Some(state) = &this.channel_editing_state
|
||||
&& state.pending_name().is_some() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.take_editing_state(window, cx);
|
||||
this.update_entries(false, cx);
|
||||
cx.notify();
|
||||
|
@ -491,12 +490,11 @@ impl CollabPanel {
|
|||
if !self.collapsed_sections.contains(&Section::ActiveCall) {
|
||||
let room = room.read(cx);
|
||||
|
||||
if query.is_empty() {
|
||||
if let Some(channel_id) = room.channel_id() {
|
||||
if query.is_empty()
|
||||
&& let Some(channel_id) = room.channel_id() {
|
||||
self.entries.push(ListEntry::ChannelNotes { channel_id });
|
||||
self.entries.push(ListEntry::ChannelChat { channel_id });
|
||||
}
|
||||
}
|
||||
|
||||
// Populate the active user.
|
||||
if let Some(user) = user_store.current_user() {
|
||||
|
@ -639,11 +637,10 @@ impl CollabPanel {
|
|||
&Default::default(),
|
||||
executor.clone(),
|
||||
));
|
||||
if let Some(state) = &self.channel_editing_state {
|
||||
if matches!(state, ChannelEditingState::Create { location: None, .. }) {
|
||||
if let Some(state) = &self.channel_editing_state
|
||||
&& matches!(state, ChannelEditingState::Create { location: None, .. }) {
|
||||
self.entries.push(ListEntry::ChannelEditor { depth: 0 });
|
||||
}
|
||||
}
|
||||
let mut collapse_depth = None;
|
||||
for mat in matches {
|
||||
let channel = channel_store.channel_at_index(mat.candidate_id).unwrap();
|
||||
|
@ -1552,8 +1549,8 @@ impl CollabPanel {
|
|||
return;
|
||||
}
|
||||
|
||||
if let Some(selection) = self.selection {
|
||||
if let Some(entry) = self.entries.get(selection) {
|
||||
if let Some(selection) = self.selection
|
||||
&& let Some(entry) = self.entries.get(selection) {
|
||||
match entry {
|
||||
ListEntry::Header(section) => match section {
|
||||
Section::ActiveCall => Self::leave_call(window, cx),
|
||||
|
@ -1645,7 +1642,6 @@ impl CollabPanel {
|
|||
ListEntry::ChannelEditor { .. } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_space(&mut self, _: &InsertSpace, window: &mut Window, cx: &mut Context<Self>) {
|
||||
|
|
|
@ -121,14 +121,13 @@ impl NotificationPanel {
|
|||
let notification_list = ListState::new(0, ListAlignment::Top, px(1000.));
|
||||
notification_list.set_scroll_handler(cx.listener(
|
||||
|this, event: &ListScrollEvent, _, cx| {
|
||||
if event.count.saturating_sub(event.visible_range.end) < LOADING_THRESHOLD {
|
||||
if let Some(task) = this
|
||||
if event.count.saturating_sub(event.visible_range.end) < LOADING_THRESHOLD
|
||||
&& let Some(task) = this
|
||||
.notification_store
|
||||
.update(cx, |store, cx| store.load_more_notifications(false, cx))
|
||||
{
|
||||
task.detach();
|
||||
}
|
||||
}
|
||||
},
|
||||
));
|
||||
|
||||
|
@ -469,8 +468,7 @@ impl NotificationPanel {
|
|||
channel_id,
|
||||
..
|
||||
} = notification.clone()
|
||||
{
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
&& let Some(workspace) = self.workspace.upgrade() {
|
||||
window.defer(cx, move |window, cx| {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
if let Some(panel) = workspace.focus_panel::<ChatPanel>(window, cx) {
|
||||
|
@ -483,7 +481,6 @@ impl NotificationPanel {
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn is_showing_notification(&self, notification: &Notification, cx: &mut Context<Self>) -> bool {
|
||||
|
@ -491,8 +488,8 @@ impl NotificationPanel {
|
|||
return false;
|
||||
}
|
||||
|
||||
if let Notification::ChannelMessageMention { channel_id, .. } = ¬ification {
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
if let Notification::ChannelMessageMention { channel_id, .. } = ¬ification
|
||||
&& let Some(workspace) = self.workspace.upgrade() {
|
||||
return if let Some(panel) = workspace.read(cx).panel::<ChatPanel>(cx) {
|
||||
let panel = panel.read(cx);
|
||||
panel.is_scrolled_to_bottom()
|
||||
|
@ -503,7 +500,6 @@ impl NotificationPanel {
|
|||
false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
@ -582,8 +578,8 @@ impl NotificationPanel {
|
|||
}
|
||||
|
||||
fn remove_toast(&mut self, notification_id: u64, cx: &mut Context<Self>) {
|
||||
if let Some((current_id, _)) = &self.current_notification_toast {
|
||||
if *current_id == notification_id {
|
||||
if let Some((current_id, _)) = &self.current_notification_toast
|
||||
&& *current_id == notification_id {
|
||||
self.current_notification_toast.take();
|
||||
self.workspace
|
||||
.update(cx, |workspace, cx| {
|
||||
|
@ -592,7 +588,6 @@ impl NotificationPanel {
|
|||
})
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn respond_to_notification(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue