From 34ab5bd01b31755501bf2197af6faed9a00bd0b0 Mon Sep 17 00:00:00 2001 From: John Barrett Date: Mon, 21 Jul 2014 12:00:46 +0100 Subject: [PATCH 1/2] Filter ideas view in similar fashion to threads. --- lib/DDGC/Web/Controller/Ideas.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/DDGC/Web/Controller/Ideas.pm b/lib/DDGC/Web/Controller/Ideas.pm index 1eec64563..339151345 100644 --- a/lib/DDGC/Web/Controller/Ideas.pm +++ b/lib/DDGC/Web/Controller/Ideas.pm @@ -130,6 +130,13 @@ sub idea_id : Chained('base') PathPart('idea') CaptureArgs(1) { $c->response->redirect($c->chained_uri('Ideas','index',{ idea_notfound => 1 })); return $c->detach; } + + if ($c->stash->{idea}->ghosted && $c->stash->{idea}->checked && + (!$c->user || (!$c->user->admin && $c->stash->{idea}->users_id != $c->user->id))) { + $c->response->redirect($c->chained_uri('Ideas','index',{ idea_notfound => 1 })); + } + + $c->add_bc($c->stash->{idea}->title,$c->chained_uri(@{$c->stash->{idea}->u})); $self->add_latest_ideas($c); } From ce3bb2350c64885ab088d7568c24f091b845be2f Mon Sep 17 00:00:00 2001 From: John Barrett Date: Mon, 21 Jul 2014 12:19:56 +0100 Subject: [PATCH 2/2] Set 'checked' flag for ignored users. --- lib/DDGC/DB/Result/Idea.pm | 3 +++ lib/DDGC/DB/Result/Thread.pm | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/DDGC/DB/Result/Idea.pm b/lib/DDGC/DB/Result/Idea.pm index 729197fb2..75d358cdc 100644 --- a/lib/DDGC/DB/Result/Idea.pm +++ b/lib/DDGC/DB/Result/Idea.pm @@ -168,6 +168,9 @@ before insert => sub { unless ($self->key) { $self->key($self->get_url); } + if ($self->user->ignore) { + $self->checked(32532); # Checked is a UID, this is johnthespamkiller + } }; sub set_user_vote { diff --git a/lib/DDGC/DB/Result/Thread.pm b/lib/DDGC/DB/Result/Thread.pm index c98379519..3acd254f7 100644 --- a/lib/DDGC/DB/Result/Thread.pm +++ b/lib/DDGC/DB/Result/Thread.pm @@ -106,6 +106,9 @@ before insert => sub { unless ($self->key) { $self->key($self->get_url); } + if ($self->user->ignore) { + $self->checked(32532); # Checked is a UID, this is johnthespamkiller + } }; after insert => sub {