- fix: cs mail posts - no url prepending

- Multiple "Re:"'s on CS Mail posts are now a thing of the past.
 - Made mail message ids follow convention.
This commit is contained in:
JT Smith 2006-06-14 17:48:38 +00:00
parent 24ed8f3e3f
commit e225c2276a
4 changed files with 26 additions and 15 deletions

View file

@ -679,9 +679,6 @@ sub processPropertiesFromFormPost {
}
$self->getThread->subscribe if ($self->session->form->process("subscribe"));
delete $self->{_storageLocation};
my $storage = $self->getStorageLocation;
my $attachmentLimit = $self->getThread->getParent->get("attachmentsPerPost");
# $storage->addFileFromFormPost("image", $attachmentLimit) if $attachmentLimit;
$self->postProcess;
$self->requestCommit;
}
@ -900,7 +897,10 @@ sub update {
);
$self->SUPER::update(@_);
if ($self->get("ownerUserId") ne $before{owner} || $self->get("groupIdEdit") ne $before{edit} || $self->get("groupIdView") ne $before{view}) {
$self->getStorageLocation->setPrivileges($self->get("ownerUserId"),$self->get("groupIdView"),$self->get("groupIdEdit"));
my $storage = $self->getStorageLocation;
if (-d $storage->getPath) {
$storage->setPrivileges($self->get("ownerUserId"),$self->get("groupIdView"),$self->get("groupIdEdit"));
}
}
}

View file

@ -216,14 +216,14 @@ sub create {
}
}
}
my $returnPath = $session->setting->get("mailReturnPath");
$returnPath = "<".$returnPath.">" if $returnPath;
my $from = $headers->{from};
$from = $session->setting->get("companyEmail") if ($from eq "");
my $type = $headers->{contentType};
$type = "multipart/mixed" if ($type eq "");
my $id = $headers->{messageId};
$id = "WebGUI-".$session->id->generate if ($id eq "");
my $from = $headers->{from} || $session->setting->get("companyEmail");
my $type = $headers->{contentType} || "multipart/mixed";
my $domain = $from;
$domain =~ s/\@(.*)/$1/;
my $id = $headers->{messageId} || "WebGUI-".$session->id->generate;
unless ($id =~ m/\@/) {
$id .= '@'.$domain;
}
my $message = MIME::Entity->build(
Type=>$type,
From=>$from,
@ -232,12 +232,14 @@ sub create {
Bcc=>$headers->{bcc},
"Reply-To"=>$headers->{replyTo},
"In-Reply-To"=>$headers->{inReplyTo},
"Return-Path"=>$returnPath,
Subject=>$headers->{subject},
"Message-Id"=>$id,
Date=>$session->datetime->epochToMail,
"X-Mailer"=>"WebGUI"
);
$message->head->delete("Return-Path");
$message->head->add("Return-Path", "<". ($session->setting->get("mailReturnPath") || $from) . ">");
my $type = $headers->{contentType};
if ($session->config->get("emailOverride")) {
my $to = $headers->{to};
$to = "WebGUI Group ".$headers->{toGroup} if ($headers->{toGroup});

View file

@ -100,11 +100,16 @@ sub addPost {
$prefix =~ s/\//\\\//g;
my $title = $message->{subject};
$title =~ s/$prefix//;
if ($title =~ m/re:/i) {
$title =~ s/re://ig;
$title = "Re: ".$title;
$title =~ s/\s+/ /g;
}
my $post = $parent->addChild({
className=>$class,
title=>$title,
menuTitle =>$title,
url=>$title,
url=>$parent->get("url")."/".$title,
content=>$content,
ownerUserId=>$user->userId,
username=>$user->profileField("alias") || $user->username,
@ -188,7 +193,7 @@ sub execute {
}
my $post = undef;
if ($message->{inReplyTo}) {
$message->{inReplyTo} =~ m/cs\-([\w_-]{22})/;
$message->{inReplyTo} =~ m/cs\-([\w_-]{22})\@/;
my $id = $1;
$post = WebGUI::Asset->newByDynamicClass($self->session, $id);
}