add email posting without subscription
This commit is contained in:
parent
612f08b37c
commit
d089539ddd
7 changed files with 76 additions and 8 deletions
|
|
@ -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