[livejournal] r18196: LJSUP-7853. Supermaintainer: notificatio...
Committer: gprochaev
LJSUP-7853. Supermaintainer: notification for appointment without a pollU trunk/bin/misc/set_comm_supermaintainer.pl U trunk/bin/upgrading/en.dat
Modified: trunk/bin/misc/set_comm_supermaintainer.pl
===================================================================
--- trunk/bin/misc/set_comm_supermaintainer.pl 2011-02-03 08:05:57 UTC (rev 18195)
+++ trunk/bin/misc/set_comm_supermaintainer.pl 2011-02-03 08:08:08 UTC (rev 18196)
@@ -121,6 +121,7 @@
$comm->log_event('set_owner', { actiontarget => $user->{userid}, remote => $system });
LJ::statushistory_add($comm, $system, 'set_owner', "LJ script set owner as ".$user->{user});
LJ::set_rel($c->{userid}, $user->{userid}, 'S');
+ _send_email_to_sm ($comm, $user->{userid});
} else {
## Search for maintainer via userlog
_log "Search in userlog for creator or first alive maintainer\n";
@@ -130,6 +131,7 @@
my $system = LJ::load_user('system');
$comm->log_event('set_owner', { actiontarget => $u->{userid}, remote => $system });
LJ::set_rel($c->{userid}, $u->{userid}, 'S');
+ _send_email_to_sm ($comm, $u->{userid});
LJ::statushistory_add($comm, $system, 'set_owner', "LJ script set owner as ".$u->{user});
} else {
_log "Create poll for supermaintainer election\n";
@@ -147,6 +149,34 @@
}
}
+sub _send_email_to_sm {
+ my $comm = shift;
+ my $maint_id = shift;
+
+ my $subject = LJ::Lang::ml('poll.election.not.need.subject');
+ my $u = LJ::load_userid ($maint_id);
+ next unless $u && $u->is_visible && $u->can_manage($comm) && $u->check_activity(90);
+ _log "\tSend email to maintainer ".$u->user."\n";
+ LJ::send_mail({ 'to' => $u->email_raw,
+ 'from' => $LJ::ACCOUNTS_EMAIL,
+ 'fromname' => $LJ::SITENAMESHORT,
+ 'wrap' => 1,
+ 'charset' => $u->mailencoding || 'utf-8',
+ 'subject' => $subject,
+ 'html' => (LJ::Lang::ml('poll.election.not.need.html', {
+ username => LJ::ljuser($u),
+ communityname => LJ::ljuser($comm),
+ faqlink => '#',
+ shortsite => $LJ::SITENAMESHORT,
+ authas => $comm->{user},
+ siteroot => $LJ::SITEROOT,
+ })
+ ),
+ });
+ ## We need a pause to change sender-id in mail headers
+ sleep 1;
+}
+
sub _check_maintainers {
my $comm = shift;
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat 2011-02-03 08:05:57 UTC (rev 18195)
+++ trunk/bin/upgrading/en.dat 2011-02-03 08:08:08 UTC (rev 18196)
@@ -3403,6 +3403,21 @@
[[shortsite]] Team
.
+poll.election.not.need.subject=Supermaintainer choosen
+
+poll.election.not.need.html<<
+Dear [[username]],<br><br>
+
+You are receiving this email because you are a maintainer of the community [[communityname]]. <br><br>
+
+According to the history for this community, you has been designated as the owner of this community.<br><br>
+
+You can read more about this role here: [[faqlink]]<br><br>
+
+Regards,<br>
+[[shortsite]] Team
+.
+
poll.election.end.email<<
Dear [[username]],
@@ -7188,4 +7203,4 @@
widget.vgifts.title=Virtual Gifts
widget.vgifts.viewall|staleness=1
-widget.vgifts.viewall=more
\ No newline at end of file
+widget.vgifts.viewall=more
