aboutsummaryrefslogtreecommitdiff
path: root/lib/Sietima
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-12-27 16:49:40 +0000
committerdakkar <dakkar@thenautilus.net>2016-12-27 16:49:40 +0000
commit6ba4ab8fb8f9c82f235656c00457c9f6dbe64ea7 (patch)
tree33a4fc4c44af33ef34015c2b425c008a1070de9b /lib/Sietima
parentmailstore: retrieve_ids_by_tags (diff)
downloadSietima-6ba4ab8fb8f9c82f235656c00457c9f6dbe64ea7.tar.gz
Sietima-6ba4ab8fb8f9c82f235656c00457c9f6dbe64ea7.tar.bz2
Sietima-6ba4ab8fb8f9c82f235656c00457c9f6dbe64ea7.zip
auto-complete mail-ids for moderation commands
Diffstat (limited to 'lib/Sietima')
-rw-r--r--lib/Sietima/Role/SubscriberOnly/Moderate.pm45
1 files changed, 21 insertions, 24 deletions
diff --git a/lib/Sietima/Role/SubscriberOnly/Moderate.pm b/lib/Sietima/Role/SubscriberOnly/Moderate.pm
index 7e231ed..678b66c 100644
--- a/lib/Sietima/Role/SubscriberOnly/Moderate.pm
+++ b/lib/Sietima/Role/SubscriberOnly/Moderate.pm
@@ -57,42 +57,39 @@ sub show_mail_from_moderation_queue ($self,$runner,@) {
around command_line_spec => sub ($orig,$self) {
my $spec = $self->$orig();
+
+ my $list_mail_ids = sub ($self,$runner,$args) {
+ $self->mail_store->retrieve_ids_by_tags('moderation');
+ };
+ my $etc = sub($cmd) {
+ return (
+ summary => "$cmd the given mail, currently held for moderation",
+ parameters => [
+ {
+ name => 'mail-id',
+ required => 1,
+ summary => "id of the mail to $cmd",
+ completion => { op => $list_mail_ids },
+ },
+ ],
+ );
+ };
+
$spec->{subcommands}{'show-held'} = {
op => 'show_mail_from_moderation_queue',
- summary => 'shows the given mail, currently held for moderation',
- parameters => [
- {
- name => 'mail-id',
- required => 1,
- summary => 'id of the mail to show',
- },
- ],
+ $etc->('show'),
};
$spec->{subcommands}{'resume-held'} = {
op => sub ($self,$runner,$args) {
$self->resume($runner->parameters->{'mail-id'});
},
- summary => 'resume the given mail, currently held for moderation',
- parameters => [
- {
- name => 'mail-id',
- required => 1,
- summary => 'id of the mail to resume',
- },
- ],
+ $etc->('resume'),
};
$spec->{subcommands}{'drop-held'} = {
op => sub ($self,$runner,$args) {
$self->drop($runner->parameters->{'mail-id'});
},
- summary => 'drop the given mail, currently held for moderation',
- parameters => [
- {
- name => 'mail-id',
- required => 1,
- summary => 'id of the mail to drop',
- },
- ],
+ $etc->('drop'),
};
$spec->{subcommands}{'list-held'} = {
op => 'list_mails_in_moderation_queue',