snoopdave commented on code in PR #328:
URL: https://github.com/apache/roller/pull/328#discussion_r4608449078
##########
app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/EntryCollection.java:
##########
@@ -405,15 +425,21 @@ private void copyToRollerEntry(Entry entry, WeblogEntry
rollerEntry) throws Webl
}
rollerEntry.setPubTime(pubTime);
rollerEntry.setUpdateTime(updateTime);
-
- AppModule control =
- (AppModule)entry.getModule(AppModule.URI);
- if (control!=null && control.getDraft()) {
+
+ boolean wasPublished =
PubStatus.PUBLISHED.equals(rollerEntry.getStatus());
+ if (isDraft(entry)) {
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:
**Important:** When a PUT changes both publication state and tags,
`setTagsAsString()` replaces the tag set before `saveWeblogEntry()` updates the
counts. For example, changing a published entry from tag A to tag B while
saving it as a draft leaves A counted, because `removeWeblogEntryTag()` checks
the new draft status. Reconcile counts using the old published tag set and the
new tag set, and add a test that changes tags during the status transition.
--
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]