Changeset 394

Show
Ignore:
Timestamp:
06/09/07 20:15:56 (6 years ago)
Author:
ivorw
Message:

Add support for only seeing recent changes that are moderated.

Location:
wiki-toolkit/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/Changes

    r393 r394  
     10.75    9  June 2007 
     2        Support for selecting versions by moderation status (see OpenGuides 
     3        ticket #142) 
     4 
    150.74    9  June 2007 
    26        Added list_last_version_before method, to get the version of all the 
  • wiki-toolkit/trunk/lib/Wiki/Toolkit.pm

    r387 r394  
    44 
    55use vars qw( $VERSION ); 
    6 $VERSION = '0.74'; 
     6$VERSION = '0.75'; 
    77 
    88use Carp qw(croak carp); 
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Store/Database.pm

    r389 r394  
    1212use Digest::MD5 qw( md5_hex ); 
    1313 
    14 $VERSION = '0.28'; 
     14$VERSION = '0.29'; 
    1515my $SCHEMA_VER = 9; 
    1616 
     
    11921192(integer), C<since> (epoch), C<last_n_changes> (integer). 
    11931193 
     1194You I<may> also supply moderation => 1 if you only want to see versions 
     1195that are moderated. 
     1196 
    11941197You I<may> also supply I<either> C<metadata_is> (and optionally 
    11951198C<metadata_isnt>), I<or> C<metadata_was> (and optionally 
     
    12571260    my ($self, %args) = @_; 
    12581261    my ($since, $limit, $between_days, $ignore_case, 
    1259         $metadata_is,  $metadata_isnt, $metadata_was, $metadata_wasnt ) = 
     1262        $metadata_is,  $metadata_isnt, $metadata_was, $metadata_wasnt, 
     1263        $moderation ) = 
    12601264         @args{ qw( since limit between_days ignore_case 
    1261                     metadata_is metadata_isnt metadata_was metadata_wasnt) }; 
     1265                    metadata_is metadata_isnt metadata_was metadata_wasnt 
     1266                    moderation ) }; 
    12621267    my $dbh = $self->dbh; 
    12631268 
     
    12781283                                 . "=$mdt.node_id 
    12791284                                 AND $main_table.version=$mdt.version\n"; 
     1285                if (defined $moderation) { 
     1286                    push @metadata_joins, "AND $main_table.moderate=$moderation"; 
     1287                } 
    12801288                push @where, "( " 
    12811289                         . $self->_get_comparison_sql( 
  • wiki-toolkit/trunk/t/022_list_unmoderated.t

    r217 r394  
    77    plan skip_all => "no backends configured"; 
    88} else { 
    9     plan tests => ( 31 * scalar @Wiki::Toolkit::TestLib::wiki_info ); 
     9    plan tests => ( 40 * scalar @Wiki::Toolkit::TestLib::wiki_info ); 
    1010} 
    1111 
     
    109109 
    110110        is_deeply( $new_mod_nodes[0], \%m21, "Should have right data" ); 
     111         
     112        my @rc_mod_nodes = $wiki->list_recent_changes( days => 7, 
     113                                                 moderation => 1); 
     114 
     115#       use Data::Dumper; 
     116#       open (my $dbug, '>', 'dbug.out') or die 'Failed to write debug'; 
     117#       print $dbug Dumper(\@rc_mod_nodes); 
     118 
     119        is( scalar(@rc_mod_nodes), 4, "Count of recent changes nodes"); 
     120        is( $rc_mod_nodes[0]{name}, 'Home', "RC node 0 name" ); 
     121        is( $rc_mod_nodes[0]{version}, 2, "RC node 0 version" ); 
     122        is( $rc_mod_nodes[1]{name}, 'Moderation', "RC node 1 name" ); 
     123        is( $rc_mod_nodes[1]{version}, 1, "RC node 1 version" ); 
     124        is( $rc_mod_nodes[2]{name}, 'Moderation2', "RC node 2 name" ); 
     125        is( $rc_mod_nodes[2]{version}, 1, "RC node 2 version" ); 
     126        is( $rc_mod_nodes[3]{name}, 'Moderation3', "RC node 3 name" ); 
     127        is( $rc_mod_nodes[3]{version}, 2, "RC node 3 version" ); 
    111128} 
     129