fix
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use std::sync::RwLock as AsyncRwLock;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
pub use actions::*;
|
||||
use anyhow::{Context as AnyhowContext, Error};
|
||||
use chat::{ChatRegistry, Message, Room, RoomEvent, SendReport, SendStatus};
|
||||
use common::{TimestampExt, coop_cache};
|
||||
use futures::lock::Mutex;
|
||||
use gpui::prelude::FluentBuilder;
|
||||
use gpui::{
|
||||
AnyElement, App, AppContext, ClipboardItem, Context, Entity, EventEmitter, FocusHandle,
|
||||
@@ -20,8 +19,6 @@ use nostr_sdk::prelude::*;
|
||||
use person::{Person, PersonRegistry};
|
||||
use settings::{AppSettings, SignerKind};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use smol::lock::RwLock as AsyncRwLock;
|
||||
use state::{NostrRegistry, upload};
|
||||
use theme::ActiveTheme;
|
||||
use ui::avatar::Avatar;
|
||||
@@ -75,7 +72,7 @@ pub struct ChatPanel {
|
||||
subject_bar: Entity<bool>,
|
||||
|
||||
/// Sent message ids
|
||||
sent_ids: Arc<AsyncRwLock<Vec<EventId>>>,
|
||||
sent_ids: Arc<Mutex<Vec<EventId>>>,
|
||||
|
||||
/// Replies to
|
||||
replies_to: Entity<HashSet<EventId>>,
|
||||
@@ -172,7 +169,7 @@ impl ChatPanel {
|
||||
attachments,
|
||||
rendered_texts_by_id: BTreeMap::new(),
|
||||
reports_by_id,
|
||||
sent_ids: Arc::new(AsyncRwLock::new(Vec::new())),
|
||||
sent_ids: Arc::new(Mutex::new(Vec::new())),
|
||||
uploading: false,
|
||||
subscriptions,
|
||||
tasks: vec![],
|
||||
@@ -207,7 +204,7 @@ impl ChatPanel {
|
||||
message,
|
||||
} = *message
|
||||
{
|
||||
let sent_ids = sent_ids.read().await;
|
||||
let sent_ids = sent_ids.lock().await;
|
||||
|
||||
if sent_ids.contains(&event_id) {
|
||||
let status = if status {
|
||||
@@ -378,7 +375,7 @@ impl ChatPanel {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
let outputs = send_task.await;
|
||||
|
||||
let mut sent_ids = sent_ids.write().await;
|
||||
let mut sent_ids = sent_ids.lock().await;
|
||||
sent_ids.extend(outputs.iter().filter_map(|output| output.gift_wrap_id));
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
|
||||
Reference in New Issue
Block a user