mraible commented on code in PR #316:
URL: https://github.com/apache/roller/pull/316#discussion_r4609099296
##########
app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/EntryCollection.java:
##########
@@ -376,11 +387,19 @@ private void copyToRollerEntry(AtomEntry entry,
WeblogEntry rollerEntry) throws
rollerEntry.setPubTime(pubTime);
rollerEntry.setUpdateTime(updateTime);
+ boolean wasPublished =
PubStatus.PUBLISHED.equals(rollerEntry.getStatus());
if (entry.isDraft()) {
rollerEntry.setStatus(PubStatus.DRAFT);
+ } else if (pubTime.after(new Date(System.currentTimeMillis() +
RollerConstants.MIN_IN_MS))) {
+ // like the entry editor, a publish time more than a minute ahead
schedules the entry
+ rollerEntry.setStatus(PubStatus.SCHEDULED);
} else {
rollerEntry.setStatus(PubStatus.PUBLISHED);
}
+ if (wasPublished != rollerEntry.isPublished()) {
+ // the entry's tags enter or leave the weblog's tag counts
+ rollerEntry.setRefreshAggregates(true);
Review Comment:
Fixed in 7630b5201: when a save moves an entry into or out of PUBLISHED,
saveWeblogEntry() now uncounts the tags the entry had before the edit (current
tags less those just added, plus those just removed) or counts the tags it has
after it, so a status change no longer depends on the new status when handling
removed tags. New EntryCollectionPermissionTest cases cover published to draft
while removing a tag, published to scheduled while changing tags (and the later
go-live), draft to published while changing tags, and a plain tag change on a
published entry.
##########
app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java:
##########
@@ -202,6 +202,15 @@ public void saveWeblogEntry(WeblogEntry entry) throws
WebloggerException {
entry.setAnchor(this.createAnchor(entry));
}
+ // if the entry was published to future, set status as SCHEDULED
+ // we only consider an entry future published if it is scheduled
+ // more than 1 minute into the future; decide this before updating the
+ // tag aggregates so a scheduled entry's tags are not counted early
+ if (PubStatus.PUBLISHED.equals(entry.getStatus()) &&
+ entry.getPubTime().after(new Date(System.currentTimeMillis() +
RollerConstants.MIN_IN_MS))) {
+ entry.setStatus(PubStatus.SCHEDULED);
Review Comment:
Fixed in 7630b5201: Blogger and MetaWeblog editPost now record whether the
entry was published before the edit and request an aggregate refresh when it
will no longer be, counting the rescheduling saveWeblogEntry() does for a
publish time more than a minute ahead.
testEditPostWithFutureDateUncountsTagsUntilTheEntryGoesLive and
testEditPostAsDraftUncountsTags check the tag counts through both handlers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]