forked from Archives/Athou_commafeed
redirect to new feed after subscribe
This commit is contained in:
@@ -39,15 +39,15 @@ public class FeedSubscriptionService {
|
||||
private final CacheService cache;
|
||||
private final CommaFeedConfiguration config;
|
||||
|
||||
public Feed subscribe(User user, String url, String title) {
|
||||
public FeedSubscription subscribe(User user, String url, String title) {
|
||||
return subscribe(user, url, title, null, 0);
|
||||
}
|
||||
|
||||
public Feed subscribe(User user, String url, String title, FeedCategory parent) {
|
||||
public FeedSubscription subscribe(User user, String url, String title, FeedCategory parent) {
|
||||
return subscribe(user, url, title, parent, 0);
|
||||
}
|
||||
|
||||
public Feed subscribe(User user, String url, String title, FeedCategory category, int position) {
|
||||
public FeedSubscription subscribe(User user, String url, String title, FeedCategory category, int position) {
|
||||
|
||||
final String pubUrl = config.getApplicationSettings().getPublicUrl();
|
||||
if (StringUtils.isBlank(pubUrl)) {
|
||||
@@ -78,7 +78,7 @@ public class FeedSubscriptionService {
|
||||
|
||||
queues.add(feed, false);
|
||||
cache.invalidateUserRootCategory(user);
|
||||
return feed;
|
||||
return sub;
|
||||
}
|
||||
|
||||
public boolean unsubscribe(User user, Long subId) {
|
||||
|
||||
@@ -399,12 +399,12 @@ public class FeedREST {
|
||||
category = feedCategoryDAO.findById(Long.valueOf(req.getCategoryId()));
|
||||
}
|
||||
FeedInfo info = fetchFeedInternal(url);
|
||||
feedSubscriptionService.subscribe(user, info.getUrl(), req.getTitle(), category);
|
||||
FeedSubscription subscription = feedSubscriptionService.subscribe(user, info.getUrl(), req.getTitle(), category);
|
||||
return Response.ok(subscription).build();
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to subscribe to URL {}: {}", url, e.getMessage(), e);
|
||||
return Response.status(Status.SERVICE_UNAVAILABLE).entity("Failed to subscribe to URL " + url + ": " + e.getMessage()).build();
|
||||
}
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
Reference in New Issue
Block a user