touchConfiguration();
}
- public PostCreated postCreated() {
- return new PostCreated() {
+ public Optional<PostCreated> postCreated() {
+ return Optional.<PostCreated>of(new PostCreated() {
@Override
public void postCreated(final Post post) {
if (post.isKnown()) {
}, 10, TimeUnit.SECONDS);
}
}
- };
+ });
}
}
package net.pterodactylus.sone.fcp;
import static com.google.common.base.Optional.fromNullable;
-import static com.google.common.base.Optional.of;
import static net.pterodactylus.sone.data.Identified.GET_ID;
import net.pterodactylus.sone.core.Core;
if (sone.equals(recipient)) {
return new ErrorResponse("Sone and Recipient must not be the same.");
}
- Post post = sone.newPostBuilder().to(fromNullable(recipient).transform(GET_ID)).withText(text).build(of(getCore().postCreated()));
+ Post post = sone.newPostBuilder().to(fromNullable(recipient).transform(GET_ID)).withText(text).build(getCore().postCreated());
return new Response("PostCreated", new SimpleFieldSetBuilder().put("Post", post.getId()).get());
}
}
Optional<Sone> recipient = webInterface.getCore().getSone(recipientId);
text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text);
- sender.get().newPostBuilder().to(recipient.transform(Identified.GET_ID)).withText(text).build(of(webInterface.getCore().postCreated()));
+ sender.get().newPostBuilder().to(recipient.transform(Identified.GET_ID)).withText(text).build(webInterface.getCore().postCreated());
throw new RedirectException(returnPage);
}
templateContext.set("errorTextEmpty", true);
return createErrorJsonObject("text-required");
}
text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text);
- Post newPost = sender.get().newPostBuilder().to(recipient.transform(GET_ID)).withText(text).build(of(webInterface.getCore().postCreated()));
+ Post newPost = sender.get().newPostBuilder().to(recipient.transform(GET_ID)).withText(text).build(webInterface.getCore().postCreated());
return createSuccessJsonObject().put("postId", newPost.getId()).put("sone", sender.get().getId()).put("recipient", newPost.getRecipientId().orNull());
}