[dw-free] replace unused 'StyleAlwaysMine' setting with wholly different NCTalkLinks setting
[commit: http://hg.dwscoalition.org/dw-free/rev/f6adc0f1e9dd]
http://bugs.dwscoalition.org/show_bug.cgi?id=1367
Switch settings.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1367
Switch settings.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/LJ/Setting/NCTalkLinks.pm
- cgi-bin/LJ/User.pm
- htdocs/manage/settings/index.bml
-------------------------------------------------------------------------------- diff -r 570c66cd219c -r f6adc0f1e9dd bin/upgrading/en.dat --- a/bin/upgrading/en.dat Sat Jul 04 01:04:01 2009 +0000 +++ b/bin/upgrading/en.dat Sat Jul 04 01:35:13 2009 +0000 @@ -2765,6 +2765,10 @@ setting.navstrip.option.journal.withrela setting.navstrip.option.journal.norelationship=journals not in your circle +setting.nctalklinks.option=Adds the comment count to entry links. Your browser should display links in a different color if there are new comments since your last visit. + +setting.nctalklinks.header=New Comment Link Indicator + setting.notifyweblogs.label=Notify Weblogs.com setting.notifyweblogs.option.comm=Notify Weblogs.com subscribers when new public entries are posted to my community diff -r 570c66cd219c -r f6adc0f1e9dd cgi-bin/LJ/Setting/NCTalkLinks.pm --- a/cgi-bin/LJ/Setting/NCTalkLinks.pm Sat Jul 04 01:04:01 2009 +0000 +++ b/cgi-bin/LJ/Setting/NCTalkLinks.pm Sat Jul 04 01:35:13 2009 +0000 @@ -1,25 +1,71 @@ package LJ::Setting::NCTalkLinks; +#!/usr/bin/perl +# +# LJ::Setting::NCTalkLinks +# +# LJ::Setting module for choosing whether or not to add ?nc=XX to the +# end of entry links, forcing the link color back to unread if the +# comment count changes. +# +# Authors: +# Denise Paolucci <denise@dreamwidth.org> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# The original version of this program was authored by LiveJournal.com +# and distributed under the terms of the license supplied by LiveJournal Inc, +# which can be found at: +# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt +# +# This program has since been wholly rewritten by Dreamwidth Studios. +# No parent code remains. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + + package LJ::Setting::NCTalkLinks; -use base 'LJ::Setting::BoolSetting'; +use base 'LJ::Setting'; use strict; use warnings; -sub tags { qw(nc comment links counts count) } +sub should_render { + my ( $class, $u ) = @_; + + return $u && ($u->is_person || $u->is_community) ? 1 : 0; +} sub label { - local $BML::ML_SCOPE = "/editinfo.bml"; - return $BML::ML{'.numcomments.header'}; + my $class = shift; + return $class->ml( 'setting.nctalklinks.header' ); } -sub des { - local $BML::ML_SCOPE = "/editinfo.bml"; - return $BML::ML{'.numcomments.about'}; +sub option { + my ( $class, $u, $errs, $args ) = @_; + + my $key = $class->pkgkey; + + my $nctalklinks = $class->get_arg( $args, "nctalklinks" ) || $u->opt_nctalklinks; + + my $ret = LJ::html_check({ + name => "${key}nctalklinks", + id => "${key}nctalklinks", + value => 1, + selected => $nctalklinks ? 1 : 0, + }); + $ret .= " <label for='${key}nctalklinks'>" . $class->ml( 'setting.nctalklinks.option' ) . "</label>"; + + return $ret; } -sub prop_name { "opt_nctalklinks" } -sub checked_value { 1 } -sub unchecked_value { 0 } +sub save { + my ( $class, $u, $args ) = @_; + + my $value = $class->get_arg( $args, "nctalklinks" ) ? "1" : "0"; + $u->opt_nctalklinks( $value ); + + return 1; +} 1; - - - diff -r 570c66cd219c -r f6adc0f1e9dd cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Sat Jul 04 01:04:01 2009 +0000 +++ b/cgi-bin/LJ/User.pm Sat Jul 04 01:35:13 2009 +0000 @@ -2003,6 +2003,16 @@ sub opt_logcommentips { return 'A'; } +sub opt_nctalklinks { + my ( $u, $val ) = @_; + + if ( defined $val && $val =~ /^[01]$/ ) { + $u->set_prop( opt_nctalklinks => $val ); + return $val; + } + + return $u->prop( 'opt_nctalklinks' ) eq "1" ? 1 : 0; +} sub opt_showcontact { my $u = shift; diff -r 570c66cd219c -r f6adc0f1e9dd htdocs/manage/settings/index.bml --- a/htdocs/manage/settings/index.bml Sat Jul 04 01:04:01 2009 +0000 +++ b/htdocs/manage/settings/index.bml Sat Jul 04 01:35:13 2009 +0000 @@ -59,7 +59,7 @@ body<= LJ::Setting::EmbedPlaceholders LJ::Setting::EmailFormat LJ::Setting::EntryEditor - LJ::Setting::StyleAlwaysMine + LJ::Setting::NCTalkLinks LJ::Setting::StyleMine LJ::Setting::NavStrip LJ::Setting::CtxPopup --------------------------------------------------------------------------------