blib/lib/Siesta/Plugin/Moderated.pm

filter: Statementstmt 79.1% 19 / 24 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 66.6% 2 / 3 totaltotal 76.3% 29 / 38 CC 3 SCAR 8.6
CC
3
Cov
71%
process
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« blib/lib/Siesta/Plugin/Subscribe.pm ↑ Summary blib/lib/Siesta/Web/FakeApache.pm »
1 # $Id: $
2 package Siesta::Plugin::Moderated;
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Siesta::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use base 'Siesta::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Siesta::Deferred;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶sub description {
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
9 1 "force all posts to be moderated by the list owner";
10 }
11  
12 # TODO let someone who's not the owner be a moderator
13  
14 1 ▶sub process {
Subroutine process: called CC=3 SCAR=16.3
Pod documented
15 1 my $self = shift;
16 1 my $mail = shift;
17 1 my $list = $self->list;
18  
19 1 ▶ return unless $self->pref('moderated');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->pref("moderated") 1 0 1
20  
21 # This job would be great if it wasn't for the fucking customers.
22 0 my $id = $mail->defer(
23 why => "moderated",
24 who => $list->owner,
25 );
26  
27  
28 0 $mail->reply( to => $list->owner->email,
29 from => $list->address('resume'),
30 subject => "deferred message",
31 body => Siesta->bake('moderated_approve',
32 list => $list,
33 mail => $mail,
34 deferred => $id),
35 );
36  
37 0 ▶ return 1 unless $self->pref('tell_user');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->pref("tell_user") 0 0 0
38  
39 0 $mail->reply( from => $list->return_path,
40 body => Siesta->bake('moderated') );
41  
42 0 return 1;
43 }
44  
45 1 ▶sub options {
Subroutine options: called CC=1 SCAR=0.0
Pod documented
46 +{
47 1 'moderated'
48 => {
49 description => "should we hold all posts to be okayed by the list-owner",
50 type => "boolean",
51 default => 0,
52 },
53 'tell_user'
54 => {
55 description => "should we tell the user if their post is being held?",
56 type => "boolean",
57 default => 0,
58 },
59 };
60 }
61  
62 3 1;
« blib/lib/Siesta/Plugin/Subscribe.pm ↑ Summary blib/lib/Siesta/Web/FakeApache.pm »