Added sendNotification flag to WebGUI::Friends::rejectAddRequest. Added setting which supresses friend rejection notices from the inbox.
This commit is contained in:
parent
6dbd389c86
commit
b0c7c1162d
6 changed files with 50 additions and 11 deletions
|
|
@ -15,6 +15,7 @@
|
|||
- fixed #11540: Pending version tags are not completed on approval under certain conditions
|
||||
- fixed #11566: Group API: group membership cannot be checked without consideration of expiration dates.
|
||||
- fixed #11567: EMS: Build badge page, ticket tab, pagination
|
||||
- added: a new inbox setting which allows administrators to choose not to send out friend rejection notices
|
||||
|
||||
7.9.4
|
||||
- We're shipping underscore.js now for its suite of extremely handy utility
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ my $session = start(); # this line required
|
|||
# upgrade functions go here
|
||||
modifySortItems( $session );
|
||||
fixRequestForApprovalScratch($session);
|
||||
addRejectNoticeSetting($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -46,6 +47,15 @@ finish($session); # this line required
|
|||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Adds setting which allows users to set whether or not to send reject notices
|
||||
sub addRejectNoticeSetting {
|
||||
my $session = shift;
|
||||
print "\tAdding reject notice setting... " unless $quiet;
|
||||
$session->setting->add('sendRejectNotice',1);
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
sub fixRequestForApprovalScratch {
|
||||
|
|
|
|||
|
|
@ -237,6 +237,12 @@ sub editSettingsForm {
|
|||
hoverHelp => $i18n->get('send inbox notifications only help'),
|
||||
defaultValue => $setting->get('sendInboxNotificationsOnly'),
|
||||
);
|
||||
$f->yesNo(
|
||||
name => 'sendRejectNotice',
|
||||
label => $i18n->get('send reject notice'),
|
||||
hoverHelp => $i18n->get('send reject notice help'),
|
||||
defaultValue => $setting->get('sendRejectNotice'),
|
||||
);
|
||||
$f->text(
|
||||
name => 'inboxNotificationsSubject',
|
||||
label => $i18n->get('inbox notifications subject'),
|
||||
|
|
@ -305,6 +311,7 @@ sub editSettingsFormSave {
|
|||
$setting->set("inboxNotificationsSubject", $form->process("inboxNotificationsSubject", "text"));
|
||||
$setting->set("inboxNotificationTemplateId", $form->process("inboxNotificationTemplateId","template"));
|
||||
$setting->set("inboxSmsNotificationTemplateId", $form->process("inboxSmsNotificationTemplateId","template"));
|
||||
$setting->set("sendRejectNotice", $form->process("sendRejectNotice","yesNo"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -604,7 +611,7 @@ sub www_approveDenyInvitations {
|
|||
next unless ($invite->{inviterId}); #Not sure how this could ever happen, but check for it
|
||||
next unless ($session->user->userId eq $invite->{friendId}); #Protect against malicious stuff
|
||||
if($deny) {
|
||||
$friends->rejectAddRequest($inviteId);
|
||||
$friends->rejectAddRequest($inviteId,$session->setting->get("sendRejectNotice"));
|
||||
}
|
||||
elsif($approve) {
|
||||
$friends->approveAddRequest($inviteId);
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ sub new {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 rejectAddRequest ( inviteId )
|
||||
=head2 rejectAddRequest ( inviteId[,sendNotification] )
|
||||
|
||||
Sends a rejection notice, and deletes the invitation.
|
||||
|
||||
|
|
@ -296,21 +296,30 @@ Sends a rejection notice, and deletes the invitation.
|
|||
|
||||
The id of an invitation.
|
||||
|
||||
=head3 sendNotification
|
||||
|
||||
Boolean indicating whether or not to send out the deny notification. Defaults to true
|
||||
|
||||
=cut
|
||||
|
||||
sub rejectAddRequest {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $inviteId = shift;
|
||||
my $notify = shift;
|
||||
|
||||
my $db = $self->session->db;
|
||||
my $invite = $self->getAddRequest($inviteId);
|
||||
my $i18n = WebGUI::International->new($self->session, "Friends");
|
||||
my $inbox = WebGUI::Inbox->new($self->session);
|
||||
$inbox->addMessage({
|
||||
message => sprintf($i18n->get("friends invitation not accepted by user"), $self->user->getWholeName),
|
||||
subject => $i18n->get('friends invitation not accepted'),
|
||||
userId => $invite->{inviterId},
|
||||
status => 'unread',
|
||||
});
|
||||
|
||||
unless (defined $notify && !$notify) { #Notify is defined but not true
|
||||
$inbox->addMessage({
|
||||
message => sprintf($i18n->get("friends invitation not accepted by user"), $self->user->getWholeName),
|
||||
subject => $i18n->get('friends invitation not accepted'),
|
||||
userId => $invite->{inviterId},
|
||||
status => 'unread',
|
||||
});
|
||||
}
|
||||
$inbox->getMessage($invite->{messageId})->setStatus('completed');
|
||||
$self->session->db->deleteRow("friendInvitations", "inviteId", $inviteId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ sub execute {
|
|||
while (my $invite = $pending->hashRef) {
|
||||
my $sentOn = WebGUI::DateTime->new($session, $invite->{dateSent});
|
||||
if (DateTime::Duration->compare($now - $sentOn, $outdated) == 1) {
|
||||
WebGUI::Friends->new($session, WebGUI::User->new($session, $invite->{friendId}))->rejectAddRequest($invite->{inviteId});
|
||||
WebGUI::Friends->new($session, WebGUI::User->new($session, $invite->{friendId}))->rejectAddRequest($invite->{inviteId},,$session->setting->get("sendRejectNotice"));
|
||||
}
|
||||
if (time() - $start > $ttl) {
|
||||
$pending->finish;
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'invitation confirm message' => {
|
||||
message => q{The following users were notified:},
|
||||
message => q{The following actions were taken:},
|
||||
lastUpdated => 1225724810,
|
||||
},
|
||||
|
||||
|
|
@ -818,6 +818,18 @@ our $I18N = {
|
|||
lastUpdated => 1242274703,
|
||||
},
|
||||
|
||||
|
||||
'send reject notice' => {
|
||||
message => q|Send Reject Friend Notifications|,
|
||||
context => q|Site setting. A notification is an email that is sent to the user being rejected.|,
|
||||
lastUpdated => 1242274705,
|
||||
},
|
||||
|
||||
'send reject notice help' => {
|
||||
message => q|Choose whether or not, upon rejecting a friend request, a notification should be sent to the user being rejected.|,
|
||||
lastUpdated => 1242274703,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue