Auto-fix clippy::collapsible_if violations (#36428)
Release Notes: - N/A
This commit is contained in:
parent
9e8ec72bd5
commit
8f567383e4
281 changed files with 6628 additions and 7089 deletions
|
@ -107,43 +107,32 @@ 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(link_position) = link_position {
|
||||
existing_view.update(cx, |channel_view, cx| {
|
||||
channel_view.focus_position_from_link(
|
||||
link_position,
|
||||
true,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
});
|
||||
}
|
||||
return existing_view;
|
||||
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| {
|
||||
channel_view.focus_position_from_link(link_position, true, window, cx)
|
||||
});
|
||||
}
|
||||
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) {
|
||||
pane.close_item_by_id(
|
||||
existing_item.entity_id(),
|
||||
SaveIntent::Skip,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
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, window, cx)
|
||||
.detach();
|
||||
pane.add_item(
|
||||
Box::new(channel_view.clone()),
|
||||
true,
|
||||
true,
|
||||
Some(ix),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
}
|
||||
pane.add_item(
|
||||
Box::new(channel_view.clone()),
|
||||
true,
|
||||
true,
|
||||
Some(ix),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(link_position) = link_position {
|
||||
|
@ -259,26 +248,21 @@ 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)
|
||||
{
|
||||
self.editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(
|
||||
SelectionEffects::scroll(Autoscroll::focused()),
|
||||
window,
|
||||
cx,
|
||||
|s| {
|
||||
s.replace_cursors_with(|map| {
|
||||
vec![item.range.start.to_display_point(map)]
|
||||
})
|
||||
},
|
||||
)
|
||||
});
|
||||
return;
|
||||
}
|
||||
{
|
||||
self.editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(
|
||||
SelectionEffects::scroll(Autoscroll::focused()),
|
||||
window,
|
||||
cx,
|
||||
|s| s.replace_cursors_with(|map| vec![item.range.start.to_display_point(map)]),
|
||||
)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if !first_attempt {
|
||||
|
|
|
@ -287,19 +287,20 @@ 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 let Some(channel_id) = self.channel_id(cx) {
|
||||
self.last_acknowledged_message_id = self
|
||||
.channel_store
|
||||
.read(cx)
|
||||
.last_acknowledge_message_id(channel_id);
|
||||
}
|
||||
|
||||
chat.update(cx, |chat, cx| {
|
||||
chat.acknowledge_last_message(cx);
|
||||
});
|
||||
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
|
||||
.read(cx)
|
||||
.last_acknowledge_message_id(channel_id);
|
||||
}
|
||||
|
||||
chat.update(cx, |chat, cx| {
|
||||
chat.acknowledge_last_message(cx);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,14 +406,13 @@ 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);
|
||||
}
|
||||
{
|
||||
active_chat.acknowledge_message(id);
|
||||
}
|
||||
|
||||
(this_message, is_continuation_from_previous, is_admin)
|
||||
|
@ -871,34 +871,33 @@ 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
|
||||
{
|
||||
this.update(cx, |this, cx| {
|
||||
if let Some(highlight_message_id) = highlight_message_id {
|
||||
let task = cx.spawn(async move |this, cx| {
|
||||
cx.background_executor().timer(Duration::from_secs(2)).await;
|
||||
this.update(cx, |this, cx| {
|
||||
this.highlighted_message.take();
|
||||
cx.notify();
|
||||
})
|
||||
.ok();
|
||||
});
|
||||
{
|
||||
this.update(cx, |this, cx| {
|
||||
if let Some(highlight_message_id) = highlight_message_id {
|
||||
let task = cx.spawn(async move |this, cx| {
|
||||
cx.background_executor().timer(Duration::from_secs(2)).await;
|
||||
this.update(cx, |this, cx| {
|
||||
this.highlighted_message.take();
|
||||
cx.notify();
|
||||
})
|
||||
.ok();
|
||||
});
|
||||
|
||||
this.highlighted_message = Some((highlight_message_id, task));
|
||||
}
|
||||
this.highlighted_message = Some((highlight_message_id, task));
|
||||
}
|
||||
|
||||
if this.active_chat.as_ref().map_or(false, |(c, _)| *c == chat) {
|
||||
this.message_list.scroll_to(ListOffset {
|
||||
item_ix,
|
||||
offset_in_item: px(0.0),
|
||||
});
|
||||
cx.notify();
|
||||
}
|
||||
})?;
|
||||
}
|
||||
if this.active_chat.as_ref().map_or(false, |(c, _)| *c == chat) {
|
||||
this.message_list.scroll_to(ListOffset {
|
||||
item_ix,
|
||||
offset_in_item: px(0.0),
|
||||
});
|
||||
cx.notify();
|
||||
}
|
||||
})?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -241,38 +241,36 @@ impl MessageEditor {
|
|||
) -> Task<Result<Vec<CompletionResponse>>> {
|
||||
if let Some((start_anchor, query, candidates)) =
|
||||
self.collect_mention_candidates(buffer, end_anchor, cx)
|
||||
&& !candidates.is_empty()
|
||||
{
|
||||
if !candidates.is_empty() {
|
||||
return cx.spawn(async move |_, cx| {
|
||||
let completion_response = Self::completions_for_candidates(
|
||||
cx,
|
||||
query.as_str(),
|
||||
&candidates,
|
||||
start_anchor..end_anchor,
|
||||
Self::completion_for_mention,
|
||||
)
|
||||
.await;
|
||||
Ok(vec![completion_response])
|
||||
});
|
||||
}
|
||||
return cx.spawn(async move |_, cx| {
|
||||
let completion_response = Self::completions_for_candidates(
|
||||
cx,
|
||||
query.as_str(),
|
||||
&candidates,
|
||||
start_anchor..end_anchor,
|
||||
Self::completion_for_mention,
|
||||
)
|
||||
.await;
|
||||
Ok(vec![completion_response])
|
||||
});
|
||||
}
|
||||
|
||||
if let Some((start_anchor, query, candidates)) =
|
||||
self.collect_emoji_candidates(buffer, end_anchor, cx)
|
||||
&& !candidates.is_empty()
|
||||
{
|
||||
if !candidates.is_empty() {
|
||||
return cx.spawn(async move |_, cx| {
|
||||
let completion_response = Self::completions_for_candidates(
|
||||
cx,
|
||||
query.as_str(),
|
||||
candidates,
|
||||
start_anchor..end_anchor,
|
||||
Self::completion_for_emoji,
|
||||
)
|
||||
.await;
|
||||
Ok(vec![completion_response])
|
||||
});
|
||||
}
|
||||
return cx.spawn(async move |_, cx| {
|
||||
let completion_response = Self::completions_for_candidates(
|
||||
cx,
|
||||
query.as_str(),
|
||||
candidates,
|
||||
start_anchor..end_anchor,
|
||||
Self::completion_for_emoji,
|
||||
)
|
||||
.await;
|
||||
Ok(vec![completion_response])
|
||||
});
|
||||
}
|
||||
|
||||
Task::ready(Ok(vec![CompletionResponse {
|
||||
|
@ -474,18 +472,17 @@ 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)
|
||||
{
|
||||
let start = multi_buffer.anchor_after(range.start);
|
||||
let end = multi_buffer.anchor_after(range.end);
|
||||
{
|
||||
let start = multi_buffer.anchor_after(range.start);
|
||||
let end = multi_buffer.anchor_after(range.end);
|
||||
|
||||
mentioned_user_ids.push(user.id);
|
||||
anchor_ranges.push(start..end);
|
||||
}
|
||||
mentioned_user_ids.push(user.id);
|
||||
anchor_ranges.push(start..end);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -311,10 +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() {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
|
@ -491,11 +491,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() {
|
||||
self.entries.push(ListEntry::ChannelNotes { channel_id });
|
||||
self.entries.push(ListEntry::ChannelChat { 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.
|
||||
|
@ -639,10 +639,10 @@ impl CollabPanel {
|
|||
&Default::default(),
|
||||
executor.clone(),
|
||||
));
|
||||
if let Some(state) = &self.channel_editing_state {
|
||||
if matches!(state, ChannelEditingState::Create { location: None, .. }) {
|
||||
self.entries.push(ListEntry::ChannelEditor { depth: 0 });
|
||||
}
|
||||
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 {
|
||||
|
@ -1552,98 +1552,93 @@ impl CollabPanel {
|
|||
return;
|
||||
}
|
||||
|
||||
if let Some(selection) = self.selection {
|
||||
if let Some(entry) = self.entries.get(selection) {
|
||||
match entry {
|
||||
ListEntry::Header(section) => match section {
|
||||
Section::ActiveCall => Self::leave_call(window, cx),
|
||||
Section::Channels => self.new_root_channel(window, cx),
|
||||
Section::Contacts => self.toggle_contact_finder(window, cx),
|
||||
Section::ContactRequests
|
||||
| Section::Online
|
||||
| Section::Offline
|
||||
| Section::ChannelInvites => {
|
||||
self.toggle_section_expanded(*section, cx);
|
||||
}
|
||||
},
|
||||
ListEntry::Contact { contact, calling } => {
|
||||
if contact.online && !contact.busy && !calling {
|
||||
self.call(contact.user.id, window, cx);
|
||||
}
|
||||
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),
|
||||
Section::Channels => self.new_root_channel(window, cx),
|
||||
Section::Contacts => self.toggle_contact_finder(window, cx),
|
||||
Section::ContactRequests
|
||||
| Section::Online
|
||||
| Section::Offline
|
||||
| Section::ChannelInvites => {
|
||||
self.toggle_section_expanded(*section, cx);
|
||||
}
|
||||
ListEntry::ParticipantProject {
|
||||
project_id,
|
||||
host_user_id,
|
||||
..
|
||||
} => {
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
let app_state = workspace.read(cx).app_state().clone();
|
||||
workspace::join_in_room_project(
|
||||
*project_id,
|
||||
*host_user_id,
|
||||
app_state,
|
||||
cx,
|
||||
)
|
||||
},
|
||||
ListEntry::Contact { contact, calling } => {
|
||||
if contact.online && !contact.busy && !calling {
|
||||
self.call(contact.user.id, window, cx);
|
||||
}
|
||||
}
|
||||
ListEntry::ParticipantProject {
|
||||
project_id,
|
||||
host_user_id,
|
||||
..
|
||||
} => {
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
let app_state = workspace.read(cx).app_state().clone();
|
||||
workspace::join_in_room_project(*project_id, *host_user_id, app_state, cx)
|
||||
.detach_and_prompt_err(
|
||||
"Failed to join project",
|
||||
window,
|
||||
cx,
|
||||
|_, _, _| None,
|
||||
);
|
||||
}
|
||||
}
|
||||
ListEntry::ParticipantScreen { peer_id, .. } => {
|
||||
let Some(peer_id) = peer_id else {
|
||||
return;
|
||||
};
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace.open_shared_screen(*peer_id, window, cx)
|
||||
});
|
||||
}
|
||||
}
|
||||
ListEntry::Channel { channel, .. } => {
|
||||
let is_active = maybe!({
|
||||
let call_channel = ActiveCall::global(cx)
|
||||
.read(cx)
|
||||
.room()?
|
||||
.read(cx)
|
||||
.channel_id()?;
|
||||
|
||||
Some(call_channel == channel.id)
|
||||
})
|
||||
.unwrap_or(false);
|
||||
if is_active {
|
||||
self.open_channel_notes(channel.id, window, cx)
|
||||
} else {
|
||||
self.join_channel(channel.id, window, cx)
|
||||
}
|
||||
}
|
||||
ListEntry::ContactPlaceholder => self.toggle_contact_finder(window, cx),
|
||||
ListEntry::CallParticipant { user, peer_id, .. } => {
|
||||
if Some(user) == self.user_store.read(cx).current_user().as_ref() {
|
||||
Self::leave_call(window, cx);
|
||||
} else if let Some(peer_id) = peer_id {
|
||||
self.workspace
|
||||
.update(cx, |workspace, cx| workspace.follow(*peer_id, window, cx))
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
ListEntry::IncomingRequest(user) => {
|
||||
self.respond_to_contact_request(user.id, true, window, cx)
|
||||
}
|
||||
ListEntry::ChannelInvite(channel) => {
|
||||
self.respond_to_channel_invite(channel.id, true, cx)
|
||||
}
|
||||
ListEntry::ChannelNotes { channel_id } => {
|
||||
self.open_channel_notes(*channel_id, window, cx)
|
||||
}
|
||||
ListEntry::ChannelChat { channel_id } => {
|
||||
self.join_channel_chat(*channel_id, window, cx)
|
||||
}
|
||||
ListEntry::OutgoingRequest(_) => {}
|
||||
ListEntry::ChannelEditor { .. } => {}
|
||||
}
|
||||
ListEntry::ParticipantScreen { peer_id, .. } => {
|
||||
let Some(peer_id) = peer_id else {
|
||||
return;
|
||||
};
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace.open_shared_screen(*peer_id, window, cx)
|
||||
});
|
||||
}
|
||||
}
|
||||
ListEntry::Channel { channel, .. } => {
|
||||
let is_active = maybe!({
|
||||
let call_channel = ActiveCall::global(cx)
|
||||
.read(cx)
|
||||
.room()?
|
||||
.read(cx)
|
||||
.channel_id()?;
|
||||
|
||||
Some(call_channel == channel.id)
|
||||
})
|
||||
.unwrap_or(false);
|
||||
if is_active {
|
||||
self.open_channel_notes(channel.id, window, cx)
|
||||
} else {
|
||||
self.join_channel(channel.id, window, cx)
|
||||
}
|
||||
}
|
||||
ListEntry::ContactPlaceholder => self.toggle_contact_finder(window, cx),
|
||||
ListEntry::CallParticipant { user, peer_id, .. } => {
|
||||
if Some(user) == self.user_store.read(cx).current_user().as_ref() {
|
||||
Self::leave_call(window, cx);
|
||||
} else if let Some(peer_id) = peer_id {
|
||||
self.workspace
|
||||
.update(cx, |workspace, cx| workspace.follow(*peer_id, window, cx))
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
ListEntry::IncomingRequest(user) => {
|
||||
self.respond_to_contact_request(user.id, true, window, cx)
|
||||
}
|
||||
ListEntry::ChannelInvite(channel) => {
|
||||
self.respond_to_channel_invite(channel.id, true, cx)
|
||||
}
|
||||
ListEntry::ChannelNotes { channel_id } => {
|
||||
self.open_channel_notes(*channel_id, window, cx)
|
||||
}
|
||||
ListEntry::ChannelChat { channel_id } => {
|
||||
self.join_channel_chat(*channel_id, window, cx)
|
||||
}
|
||||
ListEntry::OutgoingRequest(_) => {}
|
||||
ListEntry::ChannelEditor { .. } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,13 +121,12 @@ 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();
|
||||
}
|
||||
{
|
||||
task.detach();
|
||||
}
|
||||
},
|
||||
));
|
||||
|
@ -469,20 +468,19 @@ impl NotificationPanel {
|
|||
channel_id,
|
||||
..
|
||||
} = notification.clone()
|
||||
&& let Some(workspace) = self.workspace.upgrade()
|
||||
{
|
||||
if 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) {
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel
|
||||
.select_channel(ChannelId(channel_id), Some(message_id), cx)
|
||||
.detach_and_log_err(cx);
|
||||
});
|
||||
}
|
||||
});
|
||||
window.defer(cx, move |window, cx| {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
if let Some(panel) = workspace.focus_panel::<ChatPanel>(window, cx) {
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel
|
||||
.select_channel(ChannelId(channel_id), Some(message_id), cx)
|
||||
.detach_and_log_err(cx);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,18 +489,18 @@ impl NotificationPanel {
|
|||
return false;
|
||||
}
|
||||
|
||||
if let Notification::ChannelMessageMention { channel_id, .. } = ¬ification {
|
||||
if 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()
|
||||
&& panel
|
||||
.active_chat()
|
||||
.map_or(false, |chat| chat.read(cx).channel_id.0 == *channel_id)
|
||||
} else {
|
||||
false
|
||||
};
|
||||
}
|
||||
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()
|
||||
&& panel
|
||||
.active_chat()
|
||||
.map_or(false, |chat| chat.read(cx).channel_id.0 == *channel_id)
|
||||
} else {
|
||||
false
|
||||
};
|
||||
}
|
||||
|
||||
false
|
||||
|
@ -582,16 +580,16 @@ 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 {
|
||||
self.current_notification_toast.take();
|
||||
self.workspace
|
||||
.update(cx, |workspace, cx| {
|
||||
let id = NotificationId::unique::<NotificationToast>();
|
||||
workspace.dismiss_notification(&id, cx)
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
if let Some((current_id, _)) = &self.current_notification_toast
|
||||
&& *current_id == notification_id
|
||||
{
|
||||
self.current_notification_toast.take();
|
||||
self.workspace
|
||||
.update(cx, |workspace, cx| {
|
||||
let id = NotificationId::unique::<NotificationToast>();
|
||||
workspace.dismiss_notification(&id, cx)
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue