diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Rss.pm')
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Rss.pm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm index f898d06a0..4bec33057 100755 --- a/perllib/FixMyStreet/App/Controller/Rss.pm +++ b/perllib/FixMyStreet/App/Controller/Rss.pm @@ -205,14 +205,10 @@ sub query_main : Private { my ( $self, $c ) = @_; my $alert_type = $c->stash->{alert_type}; - my ( $sql_restriction ) = $c->cobrand->sql_restriction( $c->cobrand->extra_data ); - # Only apply a site restriction if the alert uses the problem table - $sql_restriction = '' unless $alert_type->item_table eq 'problem'; - # FIXME Do this in a nicer way at some point in the future... my $query = 'select * from ' . $alert_type->item_table . ' where ' . ($alert_type->head_table ? $alert_type->head_table . '_id=? and ' : '') - . $alert_type->item_where . $sql_restriction . ' order by ' + . $alert_type->item_where . ' order by ' . $alert_type->item_order; my $rss_limit = mySociety::Config::get('RSS_LIMIT'); $query .= " limit $rss_limit" unless $c->stash->{type} =~ /^all/; @@ -250,7 +246,13 @@ sub add_row : Private { (my $title = _($alert_type->item_title)) =~ s/{{(.*?)}}/$row->{$1}/g; (my $link = $alert_type->item_link) =~ s/{{(.*?)}}/$row->{$1}/g; (my $desc = _($alert_type->item_description)) =~ s/{{(.*?)}}/$row->{$1}/g; - my $url = $c->uri_for( $link ); + + my $hashref_restriction = $c->cobrand->site_restriction; + my $base_url = $c->cobrand->base_url; + if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} && $row->{council} ne $hashref_restriction->{council} ) { + $base_url = $c->config->{BASE_URL}; + } + my $url = $base_url . $link; if ( $row->{postcode} ) { my $pc = $c->cobrand->format_postcode( $row->{postcode} ); @@ -268,7 +270,7 @@ sub add_row : Private { if ($c->cobrand->allow_photo_display && $row->{photo}) { my $key = $alert_type->item_table eq 'comment' ? 'c/' : ''; - $item{description} .= ent("\n<br><img src=\"". $c->cobrand->base_url . "/photo/$key$row->{id}.jpeg\">"); + $item{description} .= ent("\n<br><img src=\"". $base_url . "/photo/$key$row->{id}.jpeg\">"); } if ( $row->{used_map} ) { |