[dw-free] edited comment notifications in the DW inbox
[commit: http://hg.dwscoalition.org/dw-free/rev/946170f4ce7a]
http://bugs.dwscoalition.org/show_bug.cgi?id=3479
Show only a brief summary for edit notifications in your DW inbox. (Email
notifications will still receive the full text)
Patch by
wyntarvox.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3479
Show only a brief summary for edit notifications in your DW inbox. (Email
notifications will still receive the full text)
Patch by
Files modified:
- cgi-bin/LJ/Event/JournalNewComment.pm
- cgi-bin/LJ/Event/JournalNewComment/Edited.pm
- cgi-bin/LJ/Talk.pm
- cgi-bin/ljdefaults.pl
--------------------------------------------------------------------------------
diff -r 06d295180af0 -r 946170f4ce7a cgi-bin/LJ/Event/JournalNewComment.pm
--- a/cgi-bin/LJ/Event/JournalNewComment.pm Fri Mar 11 16:43:35 2011 +0800
+++ b/cgi-bin/LJ/Event/JournalNewComment.pm Fri Mar 11 19:32:34 2011 +0800
@@ -29,7 +29,7 @@ sub new {
}
sub related_events {
- return map { $_->etypeid } ( $_[0], "LJ::Event::JournalNewComment::TopLevel" );
+ return map { $_->etypeid } ( $_[0], "LJ::Event::JournalNewComment::TopLevel", "LJ::Event::JournalNewComment::Edited" );
}
sub is_common { 1 }
diff -r 06d295180af0 -r 946170f4ce7a cgi-bin/LJ/Event/JournalNewComment/Edited.pm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/LJ/Event/JournalNewComment/Edited.pm Fri Mar 11 19:32:34 2011 +0800
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+#
+# LJ::Event::JournalNewComment::Edited - Event that's fired when someone edits a comment
+#
+# Authors:
+# Aaron Isaac <aaron.isaac@afourth.com>
+#
+# Copyright (c) 2011 by Dreamwidth Studios, LLC.
+#
+# 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::Event::JournalNewComment::Edited;
+use strict;
+
+use base 'LJ::Event::JournalNewComment';
+
+sub related_events {
+ return map { $_->etypeid } ( $_[0], "LJ::Event::JournalNewComment::TopLevel", "LJ::Event::JournalNewComment" );
+}
+
+sub content {
+ my ($self, $target) = @_;
+
+ my $comment = $self->comment;
+ return undef unless $self->_can_view_content( $comment, $target );
+
+ LJ::need_res( 'js/commentmanage.js' );
+
+ my $buttons = $comment->manage_buttons;
+ my $dtalkid = $comment->dtalkid;
+ my $htmlid = LJ::Talk::comment_htmlid( $dtalkid );
+
+ my $reason = LJ::ehtml( $comment->edit_reason );
+ my $comment_body = "This comment was edited.";
+ $comment_body .= " " . LJ::Lang::get_text( $target->prop( "browselang" ), "esn.journal_new_comment.edit_reason", undef, { reason => $reason } ) . "."
+ if $reason;
+
+ my $ret = qq {
+ <div id="$htmlid" class="JournalNewComment-Edited">
+ <div class="ManageButtons">$buttons</div>
+ <div class="Body">$comment_body</div>
+ </div>
+ };
+
+ my $cmt_info = $comment->info;
+ my $cmt_info_js = LJ::js_dumper($cmt_info) || '{}';
+
+ my $posterusername = $self->comment->poster ? $self->comment->poster->{user} : "";
+
+ $ret .= qq {
+ <script language="JavaScript">
+ };
+
+ while (my ($k, $v) = each %$cmt_info) {
+ $k = LJ::ejs($k);
+ $v = LJ::ejs($v);
+ $ret .= "LJ_cmtinfo['$k'] = '$v';\n";
+ }
+
+ my $dtid_cmt_info = {u => $posterusername, rc => []};
+
+ $ret .= "LJ_cmtinfo['$dtalkid'] = " . LJ::js_dumper($dtid_cmt_info) . "\n";
+
+ $ret .= qq {
+ </script>
+ };
+ $ret .= $self->as_html_actions;
+
+ return $ret;
+}
+
+1;
diff -r 06d295180af0 -r 946170f4ce7a cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm Fri Mar 11 16:43:35 2011 +0800
+++ b/cgi-bin/LJ/Talk.pm Fri Mar 11 19:32:34 2011 +0800
@@ -19,6 +19,7 @@ use Carp qw(croak);
use LJ::Constants;
use LJ::Event::JournalNewComment;
+use LJ::Event::JournalNewComment::Edited;
use LJ::Comment;
use LJ::EventLogRecord::NewComment;
use LJ::OpenID;
@@ -3747,7 +3748,7 @@ sub edit_comment {
if ( LJ::is_enabled('esn') ) {
my @jobs;
- push @jobs, LJ::Event::JournalNewComment->new($comment_obj)->fire_job;
+ push @jobs, LJ::Event::JournalNewComment::Edited->new($comment_obj)->fire_job;
push @jobs, LJ::EventLogRecord::NewComment->new($comment_obj)->fire_job;
my $sclient = LJ::theschwartz();
diff -r 06d295180af0 -r 946170f4ce7a cgi-bin/ljdefaults.pl
--- a/cgi-bin/ljdefaults.pl Fri Mar 11 16:43:35 2011 +0800
+++ b/cgi-bin/ljdefaults.pl Fri Mar 11 19:32:34 2011 +0800
@@ -229,6 +229,7 @@ no strict "vars";
InvitedFriendJoins
JournalNewComment
JournalNewComment::TopLevel
+ JournalNewComment::Edited
JournalNewEntry
NewUserpic
OfficialPost
--------------------------------------------------------------------------------

no subject
no subject