mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
fetch the entry instead of creating an empty one
This commit is contained in:
@@ -3,6 +3,7 @@ package com.commafeed.backend.services;
|
|||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import com.commafeed.backend.dao.FeedEntryDAO;
|
||||||
import com.commafeed.backend.dao.FeedEntryStatusDAO;
|
import com.commafeed.backend.dao.FeedEntryStatusDAO;
|
||||||
import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
||||||
import com.commafeed.backend.model.FeedEntry;
|
import com.commafeed.backend.model.FeedEntry;
|
||||||
@@ -18,6 +19,9 @@ public class FeedEntryService {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
FeedSubscriptionDAO feedSubscriptionDAO;
|
FeedSubscriptionDAO feedSubscriptionDAO;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FeedEntryDAO feedEntryDAO;
|
||||||
|
|
||||||
public void markEntry(User user, Long entryId, Long subscriptionId,
|
public void markEntry(User user, Long entryId, Long subscriptionId,
|
||||||
boolean read) {
|
boolean read) {
|
||||||
@@ -27,8 +31,10 @@ public class FeedEntryService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedEntry entry = new FeedEntry();
|
FeedEntry entry = feedEntryDAO.findById(entryId);
|
||||||
entry.setId(entryId);
|
if (entry == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FeedEntryStatus status = feedEntryStatusDAO.getStatus(sub, entry);
|
FeedEntryStatus status = feedEntryStatusDAO.getStatus(sub, entry);
|
||||||
|
|
||||||
@@ -61,8 +67,10 @@ public class FeedEntryService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedEntry entry = new FeedEntry();
|
FeedEntry entry = feedEntryDAO.findById(entryId);
|
||||||
entry.setId(entryId);
|
if (entry == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FeedEntryStatus status = feedEntryStatusDAO.getStatus(sub, entry);
|
FeedEntryStatus status = feedEntryStatusDAO.getStatus(sub, entry);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user