Skip Menu |
 

This queue is for tickets about the Kwiki-Notify-Mail CPAN distribution.

Report information
The Basics
Id: 8610
Status: new
Priority: 0/
Queue: Kwiki-Notify-Mail

People
Owner: Nobody in particular
Requestors: jpritikin@pobox.com (no email address)
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.02
Fixed in: (no value)



Subject: option to show the diff in the body of the email
Download (untitled) / with headers
text/plain 210b
The email body -- "Kwiki page LotsOfWikiWords edited by AnonymousGnome" -- is pretty useless. What I really want is the "diff -u" between the old version and the new version in the body of the email. Thanks!
Date: Fri, 26 Nov 2004 09:10:59 +0530
From: Joshua N Pritikin <jpritikin [...] pobox.com>
To: Kwiki-Notify-Mail <bug-Kwiki-Notify-Mail [...] rt.cpan.org>
Subject: Re: [cpan #8610] AutoReply: option to show the diff in the body of the email
RT-Send-Cc:
Download (untitled) / with headers
text/plain 111b
Actually, wdiff output would be even better. -- A new cognitive theory of emotion, http://openheartlogic.org
Date: Sun, 28 Nov 2004 11:40:36 +0530
From: Joshua N Pritikin <jpritikin [...] pobox.com>
To: Kwiki-Notify-Mail <bug-Kwiki-Notify-Mail [...] rt.cpan.org>
Subject: Re: [cpan #8610] AutoReply: option to show the diff in the body of the email
RT-Send-Cc:
Download (untitled) / with headers
text/plain 1.3k
Here's a patch. This could be improved if Kwiki wrote out the content to "page.new" and then renamed to "page". Using this procedure would make the write atomic too. --- Mail.pm Wed Sep 1 05:41:53 2004 +++ /usr/local/share/perl/5.8.4/Kwiki/Notify/Mail.pm Sun Nov 28 07:37:42 2004 @@ -20,11 +20,26 @@ sub register { my $registry = shift; - $registry->add(page_hook_store => 'notify'); + $registry->add(page_hook_prestore => 'notify'); } sub notify { - my $meta_data = $self->hub->edit->pages->current->metadata; + my $page = shift; + my $new_content = $page->content; + + my $diff; + if (-r $page->file_path) { + my $newname = $page->file_path.'.new'; + my $tmp = io($newname); + $tmp->print($new_content); + $tmp->close; + $diff = io(join(' ', '/usr/bin/diff', '-u', $page->file_path, $newname, '|'))->utf8->all; + unlink $newname; + } else { + $diff = "New page added\n"; + } + + my $meta_data = $page->metadata; my $site_title = $self->config->site_title; my $edited_by = $meta_data->{edit_by} || 'unknown name'; @@ -35,7 +50,7 @@ $site_title, $page_name, $edited_by) || 'unknown'; - my $body = "$site_title page $page_name edited by $edited_by\n"; + my $body = "$site_title page $page_name edited by $edited_by\n\n$diff"; $self->mail_it($to,$from,$subject,$body); return $self;
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: updated for kwiki 0.38 & mail 0.03
From: jpritikin [...] pobox.com
I probably should use Apache::SubProcess or Algorithm::Diff instead of backquotes.
Download diff
application/octet-stream 3.2k

Message body not shown because it is not plain text.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.