Update of /cvs/scoop/scoop/lib/Scoop/Stories
In directory lithium.sabren.com:/tmp/cvs-serv9319/lib/Scoop/Stories

Modified Files:
	Elements.pm 
Log Message:
Poll bug fixes:

* When posting a top-level comment to a poll, the poll doesn't appear in the "Replying to" field. To reproduce, open a non-attached poll, 
click "post a comment" and look at the "Replying to" area. It'll just say "0". 

* http://bugz.mostly-harmless.ca/show_bug.cgi?id=83 -- posting a comment will cause a section_perm check in Elements.pm to fire when it shouldn't (poll perms are checked earlier).

* Poll search -- go to search, choose polls, you'll get one result per answer for each poll. The postgres patches removed a "GROUP_BY" in 
the search query that prevented that, without replacing it with something that works on postgres and doesn't cause this bug. I replaced 
the group_by, because it works. If it doesn't work with postgres, then it's up to the postgres code to preserve mysql functionality 
(IMO).

--rusty


Index: Elements.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Elements.pm,v
retrieving revision 1.117
retrieving revision 1.118
diff -C2 -d -r1.117 -r1.118
*** Elements.pm	25 Jan 2005 17:15:24 -0000	1.117
--- Elements.pm	26 Jan 2005 19:24:24 -0000	1.118
***************
*** 26,35 ****
  	my $rating_choice = $S->get_comment_option('ratingchoice');
  		
! 	unless ($sid eq 'preview') {
  		$stories = $S->story_data([$sid]);
- #		$stories = $S->getstories(
- #			{-type => 'fullstory',
- #			 -sid => $sid,
- #			 -perm_override => 1});
  		if ($stories) {		 
  			$story = $stories->[0];
--- 26,31 ----
  	my $rating_choice = $S->get_comment_option('ratingchoice');
  		
! 	unless ($sid eq 'preview' || $S->_does_poll_exist($sid)) {
  		$stories = $S->story_data([$sid]);
  		if ($stories) {		 
  			$story = $stories->[0];
***************
*** 48,52 ****
  	if ( $S->_does_poll_exist($sid) == 1 ) {
  		$page .= $S->display_poll($sid);
- 		# warn "displaying poll $sid";
  	} else {
  		# warn "getting story summary for $sid\n";
--- 44,47 ----
***************
*** 76,82 ****
  	my $story_section = $story->{section} || $S->_get_story_section($sid);
  	# check the section permissions
! 	if ($S->have_section_perm('deny_read_stories', $story_section)) {
  		$page = qq| <b>%%norm_font%%Sorry, you don't have permission to read stories posted to this section.%%norm_font_end%%</b> |;
! 	} elsif ($S->have_section_perm('hide_read_stories', $section)) {
  		$page = qq| <b>%%norm_font%%Sorry, I can't seem to find that story.%%norm_font_end%%</b> |;
  	}
--- 71,77 ----
  	my $story_section = $story->{section} || $S->_get_story_section($sid);
  	# check the section permissions
! 	if ($S->have_section_perm('deny_read_stories', $story_section) && !$S->_does_poll_exist($sid)) {
  		$page = qq| <b>%%norm_font%%Sorry, you don't have permission to read stories posted to this section.%%norm_font_end%%</b> |;
! 	} elsif ($S->have_section_perm('hide_read_stories', $section) && !$S->_does_poll_exist($sid)) {
  		$page = qq| <b>%%norm_font%%Sorry, I can't seem to find that story.%%norm_font_end%%</b> |;
  	}