Builders see a reply to a deleted message as plain 'Deleted message' like everyone
Browse files at this commitf66143fbcdf408a5d384230cffa03b5ff74e69a6Parent: a5cfbc8- style
- builders see a reply to a deleted message as plain 'Deleted message' like everyone
- clicking it reveals the original quote (then clicking jumps)
2 changed files +19 -1
crates/client/src/gui/chat.rsmodified+2 -0
| @@ -142,6 +142,7 @@ pub struct Chat { | ||
| 142 | 142 | pub(super) muted: HashSet<Id>, |
| 143 | 143 | pub(super) pinned: HashSet<Id>, |
| 144 | 144 | pub(super) edits: HashMap<Id, Vec<Edit>>, |
| 145 | + pub(super) revealed: HashSet<Id>, | |
| 145 | 146 | pub(super) message_input: Entity<TextareaState>, |
| 146 | 147 | pub(super) search_input: Entity<InputState>, |
| 147 | 148 | pub(super) friends_open: bool, |
| @@ -434,6 +435,7 @@ impl Chat { | ||
| 434 | 435 | muted: HashSet::new(), |
| 435 | 436 | pinned: HashSet::new(), |
| 436 | 437 | edits: HashMap::new(), |
| 438 | + revealed: HashSet::new(), | |
| 437 | 439 | message_input, |
| 438 | 440 | search_input, |
| 439 | 441 | friends_open: false, |
crates/client/src/gui/message_actions.rsmodified+17 -1
| @@ -168,9 +168,25 @@ pub fn quote_line( | ||
| 168 | 168 | .border_color(palette.border) |
| 169 | 169 | .text_size(text(text::CAPTION)) |
| 170 | 170 | .text_color(palette.muted); |
| 171 | + let holder = message.id; | |
| 171 | 172 | let (quote, deleted) = match message.reply.as_ref()? { |
| 172 | 173 | Reply::Quote(quote) => (quote, false), |
| 173 | - Reply::Deleted(Some(quote)) => (quote, true), | |
| 174 | + Reply::Deleted(Some(quote)) if chat.revealed.contains(&holder) => (quote, true), | |
| 175 | + Reply::Deleted(Some(_)) => { | |
| 176 | + let entity = entity.clone(); | |
| 177 | + return Some( | |
| 178 | + frame | |
| 179 | + .italic() | |
| 180 | + .cursor_pointer() | |
| 181 | + .on_click(move |_, _, cx| { | |
| 182 | + entity.update(cx, |yumush, cx| { | |
| 183 | + yumush.chat.revealed.insert(holder); | |
| 184 | + cx.notify(); | |
| 185 | + }) | |
| 186 | + }) | |
| 187 | + .child(w().message_actions.deleted), | |
| 188 | + ); | |
| 189 | + } | |
| 174 | 190 | Reply::Deleted(None) => { |
| 175 | 191 | return Some(frame.italic().child(w().message_actions.deleted)); |
| 176 | 192 | } |