Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r20022: LJSUP-8061: Add ability to hide reposted...

Committer: amyshkin
LJSUP-8061: Add ability to hide reposted entries in the friends page.
A   trunk/cgi-bin/LJ/Setting/HideFriendsReposts.pm
Added: trunk/cgi-bin/LJ/Setting/HideFriendsReposts.pm
===================================================================
--- trunk/cgi-bin/LJ/Setting/HideFriendsReposts.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/Setting/HideFriendsReposts.pm	2011-09-13 02:12:10 UTC (rev 20022)
@@ -0,0 +1,57 @@
+package LJ::Setting::HideFriendsReposts;
+use base 'LJ::Setting';
+use strict;
+use warnings;
+
+sub should_render {
+    my ($class, $u) = @_;
+
+    return LJ::is_enabled("hide_friends_reposts") && $u ? 1 : 0;
+}
+
+sub helpurl {
+    my ($class, $u) = @_;
+
+    return "hide_friends_reposts";
+}
+
+sub label {
+    my $class = shift;
+
+    return $class->ml('setting.hidefriendsreposts.label');
+}
+
+sub option {
+    my ($class, $u, $errs, $args) = @_;
+    my $key = $class->pkgkey;
+
+    my $hidefriendsreposts = $class->get_arg($args, 'hidefriendsreposts') || $u->prop('hidefriendsreposts');
+
+    my $ret = LJ::html_check({
+        name     => "${key}hidefriendsreposts",
+        id       => "${key}hidefriendsreposts",
+        value    => 1,
+        selected => $hidefriendsreposts ? 1 : 0,
+    });
+
+    $ret .= " <label for='${key}hidefriendsreposts'>";
+    $ret .= $class->ml('setting.hidefriendsreposts.option.comm');
+    $ret .= "</label>";
+
+    my $errdiv = $class->errdiv($errs, 'hidefriendsreposts');
+    $ret .= "<br />$errdiv" if $errdiv;
+
+    return $ret;
+}
+
+sub save {
+    my ($class, $u, $args) = @_;
+
+    my $val = $class->get_arg($args, 'hidefriendsreposts') ? 1 : 0;
+
+    $u->set_prop('hidefriendsreposts', $val);
+
+    return 1;
+}
+
+1;

Tags: livejournal, pm, zilogic
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