feed id not required anymore

This commit is contained in:
Athou
2013-08-13 09:14:41 +02:00
parent 45b54a75db
commit 95d4f725f9
4 changed files with 12 additions and 15 deletions

View File

@@ -31,17 +31,18 @@ public class FeedEntryService {
@Inject
CacheService cache;
public void markEntry(User user, Long entryId, Long subscriptionId, boolean read) {
FeedSubscription sub = feedSubscriptionDAO.findById(user, subscriptionId);
if (sub == null) {
return;
}
public void markEntry(User user, Long entryId, boolean read) {
FeedEntry entry = feedEntryDAO.findById(entryId);
if (entry == null) {
return;
}
FeedSubscription sub = feedSubscriptionDAO.findByFeed(user, entry.getFeed());
if (sub == null) {
return;
}
FeedEntryStatus status = feedEntryStatusDAO.getStatus(sub, entry);
if (status.isMarkable()) {
status.setRead(read);
@@ -69,7 +70,8 @@ public class FeedEntryService {
}
public void markSubscriptionEntries(User user, List<FeedSubscription> subscriptions, Date olderThan) {
List<FeedEntryStatus> statuses = feedEntryStatusDAO.findBySubscriptions(subscriptions, true, null, null, -1, -1, null, false, false);
List<FeedEntryStatus> statuses = feedEntryStatusDAO
.findBySubscriptions(subscriptions, true, null, null, -1, -1, null, false, false);
markList(statuses, olderThan);
cache.invalidateUnreadCount(subscriptions.toArray(new FeedSubscription[0]));
cache.invalidateUserRootCategory(user);

View File

@@ -15,9 +15,6 @@ public class MarkRequest implements Serializable {
@ApiProperty(value = "entry id, category id, 'all' or 'starred'", required = true)
private String id;
@ApiProperty(value = "feed id, only required when marking an entry")
private Long feedId;
@ApiProperty(value = "mark as read or unread")
private boolean read;

View File

@@ -18,6 +18,7 @@ import javax.ws.rs.ext.Provider;
import org.apache.commons.io.Charsets;
import org.apache.http.HttpHeaders;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@Provider
@@ -28,7 +29,7 @@ public class JsonProvider implements MessageBodyReader<Object>, MessageBodyWrite
private static final String CONTENT_TYPE_VALUE_SUFFIX = ";charset=UTF-8";
private static final String CACHE_CONTROL_VALUE = "no-cache";
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final ObjectMapper MAPPER = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@Override
public void writeTo(Object value, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,

View File

@@ -30,7 +30,7 @@ public class EntryREST extends AbstractREST {
@Inject
FeedSubscriptionDAO feedSubscriptionDAO;
@Inject
ApplicationSettingsService applicationSettingsService;
@@ -40,9 +40,8 @@ public class EntryREST extends AbstractREST {
public Response markFeedEntry(@ApiParam(value = "Mark Request", required = true) MarkRequest req) {
Preconditions.checkNotNull(req);
Preconditions.checkNotNull(req.getId());
Preconditions.checkNotNull(req.getFeedId());
feedEntryService.markEntry(getUser(), Long.valueOf(req.getId()), req.getFeedId(), req.isRead());
feedEntryService.markEntry(getUser(), Long.valueOf(req.getId()), req.isRead());
return Response.ok(Status.OK).build();
}
@@ -73,6 +72,4 @@ public class EntryREST extends AbstractREST {
return Response.ok(Status.OK).build();
}
}