add email posting without subscription
This commit is contained in:
parent
612f08b37c
commit
d089539ddd
7 changed files with 76 additions and 8 deletions
|
|
@ -20,6 +20,8 @@
|
|||
- Added a 2.7% speed increase by precaching i18n messages. This should also
|
||||
help increase shared memory amongst Apache children. (Matt Wilson)
|
||||
- fix [ 1488921 ] Help: Commerce, Manage
|
||||
- Added two new mail posting properties to the collaboration system to get
|
||||
around a couple of problems clients have brought up.
|
||||
|
||||
6.99.0
|
||||
- Added an Events Management System asset that can help people run
|
||||
|
|
|
|||
|
|
@ -22,9 +22,17 @@ my $session = start(); # this line required
|
|||
|
||||
fixTypos($session);
|
||||
updateTemplates();
|
||||
csFixes();
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
#-------------------------------------------------
|
||||
sub csFixes {
|
||||
print "\tFixing CS stuff.\n" unless ($quiet);
|
||||
$session->db->write("alter table Collaboration add column autoSubscribeToThread int not null default 1");
|
||||
$session->db->write("alter table Collaboration add column requireSubscriptionForEmailPosting int not null default 1");
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
print "\tFixing template problems\n" unless ($quiet);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ use WebGUI::Utility;
|
|||
|
||||
our @ISA = qw(WebGUI::Asset::Post);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $newSelf = $self->SUPER::addRevision(@_);
|
||||
if ($newSelf->get("subscriptionGroupId") eq "") {
|
||||
$newSelf->createSubscriptionGroup;
|
||||
}
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub archive {
|
||||
my $self = shift;
|
||||
|
|
@ -514,9 +524,6 @@ sub prepareView {
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
if ($self->get("subscriptionGroupId") eq "") {
|
||||
$self->createSubscriptionGroup;
|
||||
}
|
||||
if ($self->session->form->process("assetId") eq "new") {
|
||||
$self->getParent->incrementThreads($self->get("dateUpdated"),$self->getId) unless ($self->isReply);
|
||||
}
|
||||
|
|
@ -527,6 +534,7 @@ sub processPropertiesFromFormPost {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -304,6 +304,14 @@ sub definition {
|
|||
label => $i18n->get("visitor cache timeout"),
|
||||
hoverHelp => $i18n->get("visitor cache timeout help")
|
||||
},
|
||||
autoSubscribeToThread => {
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>1
|
||||
},
|
||||
requireSubscriptionForEmailPosting => {
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>1
|
||||
},
|
||||
approvalWorkflow =>{
|
||||
fieldType=>"workflow",
|
||||
defaultValue=>"pbworkflow000000000003"
|
||||
|
|
@ -542,7 +550,19 @@ sub getEditForm {
|
|||
label=>$i18n->get("mail prefix"),
|
||||
hoverHelp=>$i18n->get("mail prefix help"),
|
||||
);
|
||||
$tabform->getTab("display")->interval(
|
||||
$tabform->getTab("mail")->yesNo(
|
||||
name=>"autoSubscribeToThread",
|
||||
value=>$self->getValue("autoSubscribeToThread"),
|
||||
label=>$i18n->get("auto subscribe to thread"),
|
||||
hoverHelp=>$i18n->get("auto subscribe to thread help"),
|
||||
);
|
||||
$tabform->getTab("mail")->yesNo(
|
||||
name=>"requireSubscriptionForEmailPosting",
|
||||
value=>$self->getValue("requireSubscriptionForEmailPosting"),
|
||||
label=>$i18n->get("require subscription for email posting"),
|
||||
hoverHelp=>$i18n->get("require subscription for email posting help"),
|
||||
);
|
||||
$tabform->getTab("display")->interval(
|
||||
-name=>"visitorCacheTimeout",
|
||||
-label=>$i18n->get('visitor cache timeout'),
|
||||
-hoverHelp=>$i18n->get('visitor cache timeout help'),
|
||||
|
|
|
|||
|
|
@ -256,7 +256,6 @@ sub isInGroup {
|
|||
return 1 if ($gid eq '7'); # everyone is in the everyone group
|
||||
return 1 if ($gid eq '1' && $uid eq '1'); # visitors are in the visitors group
|
||||
return 1 if ($gid eq '2' && $uid ne '1'); # if you're not a visitor, then you're a registered user
|
||||
return 1 if ($uid eq '3'); #Admin is in every group
|
||||
### Get data for auxillary checks.
|
||||
my $isInGroup = $self->session->stow->get("isInGroup");
|
||||
### Look to see if we've already looked up this group.
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ sub addPost {
|
|||
}
|
||||
$post->postProcess;
|
||||
$post->requestCommit;
|
||||
return $post;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -190,10 +191,16 @@ sub execute {
|
|||
my $id = $1;
|
||||
$post = WebGUI::Asset->newByDynamicClass($self->session, $id);
|
||||
}
|
||||
if (defined $post && $cs->get("allowReplies") && $user->isInGroup($cs->get("postGroupId")) && ($user->isInGroup($cs->get("subscriptionGroupId")) || $user->isInGroup($post->get("subscriptionGroupId")))) {
|
||||
if (defined $post && $cs->get("allowReplies") && $user->isInGroup($cs->get("postGroupId")) && (!$cs->get("requireSubscriptionForEmailPosting") || $user->isInGroup($cs->get("subscriptionGroupId")) || $user->isInGroup($post->get("subscriptionGroupId")))) {
|
||||
$self->addPost($post, $message, $user, $cs->get("mailPrefix"));
|
||||
} elsif ($user->isInGroup($cs->get("postGroupId")) && $user->isInGroup($cs->get("subscriptionGroupId"))) {
|
||||
$self->addPost($cs, $message, $user, $cs->get("mailPrefix"));
|
||||
if ($cs->get("autoSubscribeToThread") && !($user->isInGroup($cs->get("subscriptionGroupId")) || $user->isInGroup($post->get("subscriptionGroupId")))) {
|
||||
$user->addToGroups([$post->getThread->get("subscriptionGroupId")]);
|
||||
}
|
||||
} elsif ($user->isInGroup($cs->get("postGroupId")) && (!$cs->get("requireSubscriptionForEmailPosting") || $user->isInGroup($cs->get("subscriptionGroupId")))) {
|
||||
my $thread = $self->addPost($cs, $message, $user, $cs->get("mailPrefix"));
|
||||
if ($cs->get("autoSubscribeToThread") && !$user->isInGroup($cs->get("subscriptionGroupId"))) {
|
||||
$user->addToGroups([$thread->get("subscriptionGroupId")]);
|
||||
}
|
||||
} else {
|
||||
my $send = WebGUI::Mail::Send->create($self->session, {
|
||||
to=>$message->{from},
|
||||
|
|
|
|||
|
|
@ -14,6 +14,30 @@ our $I18N = {
|
|||
context => q|thread link|
|
||||
},
|
||||
|
||||
'require subscription for email posting' => {
|
||||
message => q|Require subscription for email posts?|,
|
||||
lastUpdated => 0,
|
||||
context => q|field label for mail setting|
|
||||
},
|
||||
|
||||
'require subscription for email posting help' => {
|
||||
message => q|If this is set to yes, then the user not only has to be in the group to post, but must also be subscribed to the collaboration system or thread in order to post to it.|,
|
||||
lastUpdated => 0,
|
||||
context => q|help for mail setting field label|
|
||||
},
|
||||
|
||||
'auto subscribe to thread' => {
|
||||
message => q|Auto subscribe to thread?|,
|
||||
lastUpdated => 0,
|
||||
context => q|field label for mail setting|
|
||||
},
|
||||
|
||||
'auto subscribe to thread help' => {
|
||||
message => q|If the user is not subscribed to a thread, nor the collaboration system, and they post to the CS via email, should the be subscribed to the thread? If this is set to yes, they will be. Note that this option only works if the 'Require subscription for email posts?' field is set to 'no'.|,
|
||||
lastUpdated => 0,
|
||||
context => q|help for mail setting field label|
|
||||
},
|
||||
|
||||
'mail prefix' => {
|
||||
message => q|Prefix|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue