mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
refresh button now queues the feed for refresh
This commit is contained in:
@@ -35,6 +35,7 @@ import com.commafeed.backend.dao.UserDAO;
|
||||
import com.commafeed.backend.dao.UserRoleDAO;
|
||||
import com.commafeed.backend.dao.UserSettingsDAO;
|
||||
import com.commafeed.backend.feeds.FeedFetcher;
|
||||
import com.commafeed.backend.feeds.FeedRefreshTaskGiver;
|
||||
import com.commafeed.backend.feeds.OPMLImporter;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.backend.model.UserRole.Role;
|
||||
@@ -105,6 +106,9 @@ public abstract class AbstractREST {
|
||||
@Inject
|
||||
MetricsBean metricsBean;
|
||||
|
||||
@Inject
|
||||
FeedRefreshTaskGiver taskGiver;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
CommaFeedApplication app = CommaFeedApplication.get();
|
||||
|
||||
@@ -103,6 +103,22 @@ public class FeedREST extends AbstractResourceREST {
|
||||
return info;
|
||||
}
|
||||
|
||||
@Path("/refresh")
|
||||
@POST
|
||||
@ApiOperation(value = "Queue a feed for refresh", notes = "Manually add a feed to the refresh queue")
|
||||
public Response queueForRefresh(@ApiParam(value = "Feed id") IDRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
|
||||
FeedSubscription sub = feedSubscriptionDAO.findById(getUser(),
|
||||
req.getId());
|
||||
if (sub != null) {
|
||||
taskGiver.add(sub.getFeed());
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
return Response.ok(Status.NOT_FOUND).build();
|
||||
}
|
||||
|
||||
@Path("/mark")
|
||||
@POST
|
||||
@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)")
|
||||
|
||||
Reference in New Issue
Block a user