import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
+import com.google.common.collect.Ordering;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Inject;
*/
@Override
public List<PostReply> getReplies(final String postId) {
- return database.getReplies(postId);
+ Builder<PostReply> postReplies = ImmutableList.<PostReply>builder().addAll(database.getReplies(postId));
+ if (isCompatibilityMode(CompatibilityMode.oldElementIds)) {
+ Optional<Post> post = getPost(postId);
+ if (post.isPresent()) {
+ postReplies.addAll(database.getReplies(post.get().getInternalId()));
+ }
+ }
+ return Ordering.from(Reply.TIME_COMPARATOR).sortedCopy(postReplies.build());
}
/**