wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18245: LJSUP-7914. User lj_elections must see e...

Committer: gprochaev
LJSUP-7914. User lj_elections must see election polls. But can't vote.

U   trunk/cgi-bin/LJ/Poll.pm
U   trunk/htdocs/poll/index.bml
Modified: trunk/cgi-bin/LJ/Poll.pm
===================================================================
--- trunk/cgi-bin/LJ/Poll.pm	2011-02-09 09:16:44 UTC (rev 18244)
+++ trunk/cgi-bin/LJ/Poll.pm	2011-02-09 09:28:26 UTC (rev 18245)
@@ -1032,8 +1032,11 @@
 
     my $is_super = $self->prop ('supermaintainer');
     ## Only maintainers can view, vote and see results for election polls.
-    return "<b>[" . LJ::Lang::ml('poll.error.not_enougth_rights') . "]</b>"
-        if $is_super && $remote && !$remote->can_manage($is_super);
+    if ($is_super) {
+        if (!$remote || !($remote->can_manage($is_super) || LJ::u_equals($remote, $self->journal))) {
+            return "<b>[" . LJ::Lang::ml('poll.error.not_enougth_rights') . "]</b>";
+        }
+    }
 
     # Default pagesize.
     $pagesize = 2000 unless $pagesize;
@@ -1515,10 +1518,18 @@
     }
 
     if ($do_form) {
-        $ret .= LJ::html_submit(
-                                'poll-submit',
-                                $is_super ? LJ::Lang::ml('poll.vote') : LJ::Lang::ml('poll.submit'),
-                                {class => 'LJ_PollSubmit'}) . "</form>\n";;
+        unless ($is_super) {
+            $ret .= LJ::html_submit(
+                                    'poll-submit',
+                                    $is_super ? LJ::Lang::ml('poll.vote') : LJ::Lang::ml('poll.submit'),
+                                    {class => 'LJ_PollSubmit'}) . "</form>\n";;
+        }
+        if ($is_super && $remote && $remote->can_manage($is_super) && !LJ::u_equals($remote, $self->journal)) {
+            $ret .= LJ::html_submit(
+                                    'poll-submit',
+                                    $is_super ? LJ::Lang::ml('poll.vote') : LJ::Lang::ml('poll.submit'),
+                                    {class => 'LJ_PollSubmit'}) . "</form>\n";;
+        }
     }
     if ($is_super) {
         $ret .= "</td></tr></table></div></div>" . "<div class='poll-side'>" . $ret_side . "</div>";

Modified: trunk/htdocs/poll/index.bml
===================================================================
--- trunk/htdocs/poll/index.bml	2011-02-09 09:16:44 UTC (rev 18244)
+++ trunk/htdocs/poll/index.bml	2011-02-09 09:28:26 UTC (rev 18245)
@@ -72,9 +72,9 @@
         $body = $ML{'.error.postdeleted'};
         return;
     }
-
+    
     my $sm_u = LJ::load_userid($is_super);
-    unless (($sm_u && $remote->can_manage($sm_u)) || $entry->visible_to($remote)) {
+    unless (($sm_u && $remote && $remote->can_manage($sm_u)) || $entry->visible_to($remote)) {
         $body = $ML{'.error.cantview'};
         return;
     }

Tags: bml, livejournal, pm, wisest-owl
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments