Fixing email action when the user is not authenticated

This commit is contained in:
Sebastien Ros 2012-02-29 13:23:50 -08:00
parent 4a95f697dd
commit 39ba3e1ac1

View File

@ -50,9 +50,9 @@ namespace Orchard.Email.Rules {
if (recipient == "owner") {
var content = context.Tokens["Content"] as IContent;
if (content.Has<CommonPart>()) {
var owner = content.As<CommonPart>().Owner.ContentItem;
if (owner != null && owner.Record != null) {
_messageManager.Send(owner.Record, MessageType, "email", properties);
var owner = content.As<CommonPart>().Owner;
if (owner != null && owner.ContentItem != null && owner.ContentItem.Record != null) {
_messageManager.Send(owner.ContentItem.Record, MessageType, "email", properties);
}
_messageManager.Send(
SplitEmail(owner.As<IUser>().Email), MessageType, "email", properties);