Make ContentService.SendToPublication() More Flexible.
Hi Guys,
I have been using Umbraco for quite a while now but never actually had a look at the code, but because of a few issues I have been having* I went to git hub and had a look at what actually happens when you call
ContentService.SendToPublication()
When this method is called it, it all so calls ContentService.Save() and there is no way of stopping it from raising a Save event....
public bool SendToPublication(IContent content, int userId = 0)
{
if (SendingToPublish.IsRaisedEventCancelled(new SendToPublishEventArgs<IContent>(content), this))
return false;
//Save before raising event
Save(content, userId);
SentToPublish.RaiseEvent(new SendToPublishEventArgs<IContent>(content, false), this);
Audit(AuditType.SendToPublish, "Send to Publish performed by user", content.WriterId, content.Id);
return true;
}
So I suggest, that ContentService.SendToPublication() be changed to accept an optional bool parameter so that you are not forced to raise a save event when you send content to publication.
So it would would look something like this....
public bool SendToPublication(IContent content, int userId = 0, bool raiseEvents = true)
{
if (SendingToPublish.IsRaisedEventCancelled(new SendToPublishEventArgs<IContent>(content), this))
return false;
//Save before raising event
Save(content, userId, raiseEvents);
SentToPublish.RaiseEvent(new SendToPublishEventArgs<IContent>(content, false), this);
Audit(AuditType.SendToPublish, "Send to Publish performed by user", content.WriterId, content.Id);
return true;
}
Make ContentService.SendToPublication() More Flexible.
Hi Guys,
I have been using Umbraco for quite a while now but never actually had a look at the code, but because of a few issues I have been having* I went to git hub and had a look at what actually happens when you call
ContentService.SendToPublication()
When this method is called it, it all so calls ContentService.Save() and there is no way of stopping it from raising a Save event....
So I suggest, that ContentService.SendToPublication() be changed to accept an optional bool parameter so that you are not forced to raise a save event when you send content to publication.
So it would would look something like this....
What do you think guys?
*https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/83686-whats-the-difference-between-contentservicesave-and-contentservicesendtopublication
*https://our.umbraco.org/forum/extending-umbraco-and-using-the-api//83673-contentservicesaveandpublishwithstatus-vs-contentservicesendtopublication
Hi,
Please see this issue here: http://issues.umbraco.org/issue/U4-9490
is working on a reply...