fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-11-24 11:13 am

[dw-free] Indication of successful comment posting, when locked out of an entry

[commit: http://hg.dwscoalition.org/dw-free/rev/81a94e892108]

http://bugs.dwscoalition.org/show_bug.cgi?id=3073

Message that comment was posted successfully when posting to a locked entry
using an alt account (which your currently logged in account cannot see).

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/Controller/Protected.pm
  • htdocs/talkpost_do.bml
  • views/protected.tt
  • views/protected.tt.text
--------------------------------------------------------------------------------
diff -r 5cbc72b2428f -r 81a94e892108 cgi-bin/DW/Controller/Protected.pm
--- a/cgi-bin/DW/Controller/Protected.pm	Wed Nov 24 15:19:46 2010 +0800
+++ b/cgi-bin/DW/Controller/Protected.pm	Wed Nov 24 19:12:44 2010 +0800
@@ -46,6 +46,7 @@ sub protected_handler {
 
     my $vars = {
         returnto => $returnto,
+        message => $r->get_args->{posted} ? '.message.comment.posted' : '',
     };
 
     my $remote = $rv->{remote};
@@ -65,7 +66,7 @@ sub protected_handler {
         # include SSL if it's an option
         $vars->{'usessl'} = $LJ::USE_SSL;
     }
-    
+
     return DW::Template->render_template( 'protected.tt', $vars );
 
 }
diff -r 5cbc72b2428f -r 81a94e892108 htdocs/talkpost_do.bml
--- a/htdocs/talkpost_do.bml	Wed Nov 24 15:19:46 2010 +0800
+++ b/htdocs/talkpost_do.bml	Wed Nov 24 19:12:44 2010 +0800
@@ -221,8 +221,11 @@ body<=
     # Allow style=mine, etc for QR redirects
     my $style_args = LJ::viewing_style_args( %POST );
 
+    # FIXME: potentially can be replaced with some form of additional logic when we have multiple account linkage
+    my $posted = $comment->{state} eq 'A' ? "posted=1" : "";
+
     my $cthread = $POST{'viewing_thread'} ? "thread=$POST{viewing_thread}" : "view=$dtalkid";
-    my $commentlink = LJ::Talk::talkargs( $talkurl, $cthread, $style_args ) . LJ::Talk::comment_anchor( $dtalkid );
+    my $commentlink = LJ::Talk::talkargs( $talkurl, $cthread, $style_args, $posted ) . LJ::Talk::comment_anchor( $dtalkid );
 
     my $ret = "";
     $ret .= "<?h1 $ML{'.success.title'} h1?>";
diff -r 5cbc72b2428f -r 81a94e892108 views/protected.tt
--- a/views/protected.tt	Wed Nov 24 15:19:46 2010 +0800
+++ b/views/protected.tt	Wed Nov 24 19:12:44 2010 +0800
@@ -12,6 +12,10 @@ reference 'perldoc perlartistic' or 'per
 
 [% sections.title = '.title' | ml %]
 [% dw.need_res('stc/widgets/protected.css') %]
+
+[% IF message %]
+    <p>[% message | ml %]</p>
+[% END %]
 
 <div class="errorbar" style="background-image: URL('[%- roots.img -%]/message-error.gif');">
 <strong>
diff -r 5cbc72b2428f -r 81a94e892108 views/protected.tt.text
--- a/views/protected.tt.text	Wed Nov 24 15:19:46 2010 +0800
+++ b/views/protected.tt.text	Wed Nov 24 19:12:44 2010 +0800
@@ -1,4 +1,7 @@
 ;; -*- coding: utf-8 -*-
+
+.message.comment.posted=Comment was posted successfully.
+
 .protected.error.notauthorised.comm.closed=This protected entry is viewable by community members only. Membership to this community is closed.
 
 .protected.error.notauthorised.comm.open=This protected entry is viewable by community members only. Would you like to <a href="[[siteroot]]/community/join?comm=[[journalname]]">join the community</a>?
--------------------------------------------------------------------------------