afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-08-22 03:19 am

[dw-free] news module on homepage should reflect current reading status

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

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

Different string/logic between add and modify.

Patch by [personal profile] afuna.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/DW/Widget/LatestNews.pm
--------------------------------------------------------------------------------
diff -r 93978c6a5e76 -r ee248b71d181 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Sat Aug 22 03:13:46 2009 +0000
+++ b/bin/upgrading/en.dat	Sat Aug 22 03:19:06 2009 +0000
@@ -4304,7 +4304,9 @@ widget.latestnews.comments=[[num_comment
 
 widget.latestnews.more=(Read more...)
 
-widget.latestnews.subscribe=<a [[aopts]]>Add</a> [[news]] to your reading list
+widget.latestnews.subscribe.add=<a [[aopts]]>Add</a> [[news]] to your reading list
+
+widget.latestnews.subscribe.modify=<a [[aopts]]>Modify your subscription</a> to [[news]]
 
 widget.latestnews.title=[[sitename]] News
 
diff -r 93978c6a5e76 -r ee248b71d181 cgi-bin/DW/Widget/LatestNews.pm
--- a/cgi-bin/DW/Widget/LatestNews.pm	Sat Aug 22 03:13:46 2009 +0000
+++ b/cgi-bin/DW/Widget/LatestNews.pm	Sat Aug 22 03:19:06 2009 +0000
@@ -50,9 +50,17 @@ sub render_body {
 
     $ret .= "<div class='sidebar'>";
     $ret .= "<p><a href='" . $entry->url . "#comments'>" . $class->ml( 'widget.latestnews.comments', { num_comments => $entry->reply_count } ) . "</a></p>";
-    $ret .= "<p>" . $class->ml( 'widget.latestnews.subscribe', { 
-        aopts => "href='$LJ::SITEROOT/manage/circle/add?user=" . $news_journal->user. "&action=subscribe'",
-        news => LJ::ljuser( $news_journal ) } ) . "</p>";
+
+    if ( $remote->watches( $news_journal ) ) {
+        $ret .= "<p>" . $class->ml( 'widget.latestnews.subscribe.modify', { 
+            aopts => "href='$LJ::SITEROOT/manage/circle/add?user=" . $news_journal->user . "'",
+            news => LJ::ljuser( $news_journal ) } ) . "</p>";
+    } else {
+        $ret .= "<p>" . $class->ml( 'widget.latestnews.subscribe.add', { 
+            aopts => "href='$LJ::SITEROOT/manage/circle/add?user=" . $news_journal->user. "&action=subscribe'",
+            news => LJ::ljuser( $news_journal ) } ) . "</p>";
+    }
+
     $ret .= "</div>";
 
     $ret .= "<div class='contents'>";
--------------------------------------------------------------------------------