[Cpan-forum-commit] rev 304 - in trunk: . lib/CPAN/Forum/RM
svn at pti.co.il
svn at pti.co.il
Wed Jul 25 17:46:23 EEST 2007
Author: gabor
Date: 2007-07-25 17:46:23 +0300 (Wed, 25 Jul 2007)
New Revision: 304
Modified:
trunk/
trunk/lib/CPAN/Forum/RM/Subscriptions.pm
Log:
separate out the _get_all_subscriptions method in CPAN::Forum::RM::Subscriptions
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4324
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
+ 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4325
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
Modified: trunk/lib/CPAN/Forum/RM/Subscriptions.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Subscriptions.pm 2007-07-25 14:45:57 UTC (rev 303)
+++ trunk/lib/CPAN/Forum/RM/Subscriptions.pm 2007-07-25 14:46:23 UTC (rev 304)
@@ -51,43 +51,10 @@
my $gids;
- if (@params == 2 and $params[0] eq "dist") { # specific distribution
- ($gids, @subscriptions) = $self->_module_subscription($user, $params[1]);
- } else { # show all subscriptions
- my ($s) = CPAN::Forum::DB::Subscriptions_all->search(uid => $user->{id});
- $self->log->debug("all subscriptions " . ($s ? "found" : "not found"));
- push @subscriptions, {
- gid => "_all",
- group => "All",
- allposts => $s ? $s->allposts : '',
- starters => $s ? $s->starters : '',
- followups => $s ? $s->followups : '',
- };
- $gids = "_all";
-
- my $it = CPAN::Forum::DB::Subscriptions_pauseid->search(uid => $user->{id});
- while (my $s = $it->next) {
- $gids .= ($gids ? ",_" : "_") . $s->pauseid->id;
- push @subscriptions, {
- gid => "_" . $s->pauseid->id,
- group => $s->pauseid->pauseid,
- allposts => $s->allposts,
- starters => $s->starters,
- followups => $s->followups,
- };
- }
-
- $it = CPAN::Forum::DB::Subscriptions->search(uid => $user->{id});
- while (my $s = $it->next) {
- $gids .= ($gids ? "," : "") . $s->gid->id;
- push @subscriptions, {
- gid => $s->gid,
- group => $s->gid->name,
- allposts => $s->allposts,
- starters => $s->starters,
- followups => $s->followups,
- };
- }
+ if (@params == 2 and $params[0] eq "dist") {
+ ($gids, @subscriptions) = $self->_get_module_subscription($user, $params[1]);
+ } else {
+ ($gids, @subscriptions) = $self->_get_all_subscriptions($user);
}
$t->param(subscriptions => \@subscriptions);
@@ -95,7 +62,50 @@
$t->output;
}
-sub _module_subscription {
+
+sub _get_all_subscriptions {
+ my ($self, $user) = @_;
+
+ my @subscriptions;
+ my ($s) = CPAN::Forum::DB::Subscriptions_all->search(uid => $user->{id});
+ $self->log->debug("all subscriptions " . ($s ? "found" : "not found"));
+ push @subscriptions, {
+ gid => "_all",
+ group => "All",
+ allposts => $s ? $s->allposts : '',
+ starters => $s ? $s->starters : '',
+ followups => $s ? $s->followups : '',
+ };
+ my $gids = "_all";
+
+ my $it = CPAN::Forum::DB::Subscriptions_pauseid->search(uid => $user->{id});
+ while (my $s = $it->next) {
+ $gids .= ($gids ? ",_" : "_") . $s->pauseid->id;
+ push @subscriptions, {
+ gid => "_" . $s->pauseid->id,
+ group => $s->pauseid->pauseid,
+ allposts => $s->allposts,
+ starters => $s->starters,
+ followups => $s->followups,
+ };
+ }
+
+ $it = CPAN::Forum::DB::Subscriptions->search(uid => $user->{id});
+ while (my $s = $it->next) {
+ $gids .= ($gids ? "," : "") . $s->gid->id;
+ push @subscriptions, {
+ gid => $s->gid,
+ group => $s->gid->name,
+ allposts => $s->allposts,
+ starters => $s->starters,
+ followups => $s->followups,
+ };
+ }
+ return ($gids, @subscriptions);
+}
+
+
+sub _get_module_subscription {
my ($self, $user, $group_name) = @_;
my $group = CPAN::Forum::DB::Groups->info_by(name => $group_name); # SQL
More information about the Cpan-forum-commit
mailing list