Browse Source

Rename toggle_thread_snooze to "toggle thread_snooze"

For consistency with other toggle commands.
jmap-eventsource
Manos Pitsidianakis 1 year ago
parent
commit
310d02042f
Signed by untrusted user: epilys GPG Key ID: 73627C2F690DF710
  1. 2
      docs/meli.1
  2. 10
      src/command.rs
  3. 3
      src/command/actions.rs
  4. 2
      src/components/mail/listing/compact.rs
  5. 2
      src/components/mail/listing/conversations.rs
  6. 4
      src/state.rs

2
docs/meli.1

@ -395,7 +395,7 @@ where
is a mailbox prefixed with the
.Ar n
number in the side menu for the current account
.It Cm toggle_thread_snooze
.It Cm toggle thread_snooze
don't issue notifications for thread under cursor in thread listing
.It Cm search Ar STRING
search mailbox with

10
src/command.rs

@ -380,14 +380,16 @@ define_commands!([
}
)
},
{ tags: ["toggle_thread_snooze"],
{ tags: ["toggle thread_snooze"],
desc: "turn off new notifications for this thread",
tokens: &[One(Literal("toggle_thread_snooze"))],
tokens: &[One(Literal("toggle thread_snooze"))],
parser: (
fn toggle_thread_snooze(input: &[u8]) -> IResult<&[u8], Action> {
let (input, _) = tag("toggle_thread_snooze")(input.trim())?;
let (input, _) = tag("toggle")(input)?;
let (input, _) = is_a(" ")(input)?;
let (input, _) = tag("thread_snooze")(input)?;
let (input, _) = eof(input)?;
Ok((input, ToggleThreadSnooze))
Ok((input, Listing(ToggleThreadSnooze)))
}
)
},

3
src/command/actions.rs

@ -54,6 +54,7 @@ pub enum ListingAction {
Delete,
OpenInNewTab,
Tag(TagAction),
ToggleThreadSnooze,
}
#[derive(Debug)]
@ -111,7 +112,6 @@ pub enum Action {
Sort(SortField, SortOrder),
SubSort(SortField, SortOrder),
Tab(TabAction),
ToggleThreadSnooze,
MailingListAction(MailingListAction),
View(ViewAction),
SetEnv(String, String),
@ -131,7 +131,6 @@ impl Action {
Action::Sort(_, _) => false,
Action::SubSort(_, _) => false,
Action::Tab(_) => false,
Action::ToggleThreadSnooze => false,
Action::MailingListAction(_) => true,
Action::View(_) => false,
Action::SetEnv(_, _) => false,

2
src/components/mail/listing/compact.rs

@ -1572,7 +1572,7 @@ impl Component for CompactListing {
// FIXME: perform subsort.
return true;
}
Action::ToggleThreadSnooze if !self.unfocused => {
Action::Listing(ToggleThreadSnooze) if !self.unfocused => {
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
let account = &mut context.accounts[&self.cursor_pos.0];
account

2
src/components/mail/listing/conversations.rs

@ -1504,7 +1504,7 @@ impl Component for ConversationsListing {
*/
return true;
}
Action::ToggleThreadSnooze if !self.unfocused => {
Action::Listing(ToggleThreadSnooze) if !self.unfocused => {
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
let account = &mut context.accounts[&self.cursor_pos.0];
account

4
src/state.rs

@ -1111,8 +1111,8 @@ impl State {
UIEvent::FinishedUIDialog(ref id, ref mut results)
if self.overlay.iter().any(|c| c.id() == *id) =>
{
if let Some(Some(ref mut action)) = results.downcast_mut::<Option<Action>>() {
self.exec_command(std::mem::replace(action, Action::ToggleThreadSnooze));
if let Some(ref mut action @ Some(_)) = results.downcast_mut::<Option<Action>>() {
self.exec_command(action.take().unwrap());
let pos = self.overlay.iter().position(|c| c.id() == *id).unwrap();
self.overlay.remove(pos);

Loading…
Cancel
Save