* @return The created post
*/
public Post createPost(Sone sone, Optional<Sone> recipient, String text) {
- return createPost(sone, recipient, System.currentTimeMillis(), text);
- }
-
- /**
- * Creates a new post.
- *
- * @param sone
- * The Sone that creates the post
- * @param recipient
- * The recipient Sone, or {@code null} if this post does not have
- * a recipient
- * @param time
- * The time of the post
- * @param text
- * The text of the post
- * @return The created post
- */
- public Post createPost(Sone sone, Optional<Sone> recipient, long time, String text) {
checkNotNull(text, "text must not be null");
checkArgument(text.trim().length() > 0, "text must not be empty");
if (!sone.isLocal()) {
return null;
}
PostBuilder postBuilder = database.newPostBuilder();
- postBuilder.from(sone.getId()).randomId().withTime(time).withText(text.trim());
+ postBuilder.from(sone.getId()).randomId().currentTime().withText(text.trim());
if (recipient.isPresent()) {
postBuilder.to(recipient.get().getId());
}
}
Optional<Sone> recipient = webInterface.getCore().getSone(recipientId);
text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text);
- webInterface.getCore().createPost(sender, recipient, System.currentTimeMillis(), text);
+ webInterface.getCore().createPost(sender, recipient, text);
throw new RedirectException(returnPage);
}
templateContext.set("errorTextEmpty", true);