forked from Archives/Athou_commafeed
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.UserRoleDAO;
|
||||||
import com.commafeed.backend.dao.UserSettingsDAO;
|
import com.commafeed.backend.dao.UserSettingsDAO;
|
||||||
import com.commafeed.backend.feeds.FeedFetcher;
|
import com.commafeed.backend.feeds.FeedFetcher;
|
||||||
|
import com.commafeed.backend.feeds.FeedRefreshTaskGiver;
|
||||||
import com.commafeed.backend.feeds.OPMLImporter;
|
import com.commafeed.backend.feeds.OPMLImporter;
|
||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.commafeed.backend.model.UserRole.Role;
|
import com.commafeed.backend.model.UserRole.Role;
|
||||||
@@ -105,6 +106,9 @@ public abstract class AbstractREST {
|
|||||||
@Inject
|
@Inject
|
||||||
MetricsBean metricsBean;
|
MetricsBean metricsBean;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FeedRefreshTaskGiver taskGiver;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
CommaFeedApplication app = CommaFeedApplication.get();
|
CommaFeedApplication app = CommaFeedApplication.get();
|
||||||
|
|||||||
@@ -103,6 +103,22 @@ public class FeedREST extends AbstractResourceREST {
|
|||||||
return info;
|
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")
|
@Path("/mark")
|
||||||
@POST
|
@POST
|
||||||
@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)")
|
@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',
|
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,
|
function($scope, $http, $state, $stateParams, $route, $location,
|
||||||
SettingsService, EntryService, ProfileService, AnalyticsService, ServerService) {
|
SettingsService, EntryService, ProfileService, AnalyticsService, ServerService, FeedService) {
|
||||||
|
|
||||||
function totalActiveAjaxRequests() {
|
function totalActiveAjaxRequests() {
|
||||||
return ($http.pendingRequests.length + $.active);
|
return ($http.pendingRequests.length + $.active);
|
||||||
@@ -195,7 +195,13 @@ function($scope, $http, $state, $stateParams, $route, $location,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.refresh = function() {
|
$scope.refresh = function() {
|
||||||
|
if($stateParams._type == 'feed'){
|
||||||
|
FeedService.refresh({
|
||||||
|
id : $stateParams._id
|
||||||
|
});
|
||||||
|
}
|
||||||
$scope.$emit('emitReload');
|
$scope.$emit('emitReload');
|
||||||
|
|
||||||
};
|
};
|
||||||
$scope.markAllAsRead = function() {
|
$scope.markAllAsRead = function() {
|
||||||
$scope.$emit('emitMarkAll', {
|
$scope.$emit('emitMarkAll', {
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ function($resource, $http) {
|
|||||||
_method : 'mark'
|
_method : 'mark'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
refresh : {
|
||||||
|
method : 'POST',
|
||||||
|
params : {
|
||||||
|
_method : 'refresh'
|
||||||
|
}
|
||||||
|
},
|
||||||
subscribe : {
|
subscribe : {
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
params : {
|
params : {
|
||||||
|
|||||||
Reference in New Issue
Block a user