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)")
|
||||
|
||||
@@ -165,9 +165,9 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat
|
||||
}]);
|
||||
|
||||
module.controller('ToolbarCtrl', ['$scope', '$http', '$state', '$stateParams',
|
||||
'$route', '$location', 'SettingsService', 'EntryService', 'ProfileService', 'AnalyticsService', 'ServerService',
|
||||
'$route', '$location', 'SettingsService', 'EntryService', 'ProfileService', 'AnalyticsService', 'ServerService', 'FeedService',
|
||||
function($scope, $http, $state, $stateParams, $route, $location,
|
||||
SettingsService, EntryService, ProfileService, AnalyticsService, ServerService) {
|
||||
SettingsService, EntryService, ProfileService, AnalyticsService, ServerService, FeedService) {
|
||||
|
||||
function totalActiveAjaxRequests() {
|
||||
return ($http.pendingRequests.length + $.active);
|
||||
@@ -195,7 +195,13 @@ function($scope, $http, $state, $stateParams, $route, $location,
|
||||
}
|
||||
});
|
||||
$scope.refresh = function() {
|
||||
if($stateParams._type == 'feed'){
|
||||
FeedService.refresh({
|
||||
id : $stateParams._id
|
||||
});
|
||||
}
|
||||
$scope.$emit('emitReload');
|
||||
|
||||
};
|
||||
$scope.markAllAsRead = function() {
|
||||
$scope.$emit('emitMarkAll', {
|
||||
|
||||
@@ -62,6 +62,12 @@ function($resource, $http) {
|
||||
_method : 'mark'
|
||||
}
|
||||
},
|
||||
refresh : {
|
||||
method : 'POST',
|
||||
params : {
|
||||
_method : 'refresh'
|
||||
}
|
||||
},
|
||||
subscribe : {
|
||||
method : 'POST',
|
||||
params : {
|
||||
|
||||
Reference in New Issue
Block a user