Rename toggle_thread_snooze to "toggle thread_snooze"

For consistency with other toggle commands.
jmap-eventsource
Manos Pitsidianakis 2020-10-14 13:17:54 +03:00
parent 188e020bd1
commit 310d02042f
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
6 changed files with 12 additions and 11 deletions

View File

@ -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

View File

@ -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)))
}
)
},

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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);