forked from Archives/Athou_commafeed
prevent subscription to our own feeds
This commit is contained in:
@@ -32,11 +32,20 @@ public class FeedSubscriptionService {
|
|||||||
@Inject
|
@Inject
|
||||||
FeedSubscriptionDAO feedSubscriptionDAO;
|
FeedSubscriptionDAO feedSubscriptionDAO;
|
||||||
|
|
||||||
@Inject FeedRefreshTaskGiver taskGiver;
|
@Inject
|
||||||
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FeedRefreshTaskGiver taskGiver;
|
||||||
|
|
||||||
public Feed subscribe(User user, String url, String title,
|
public Feed subscribe(User user, String url, String title,
|
||||||
FeedCategory category) {
|
FeedCategory category) {
|
||||||
|
|
||||||
|
if (url.startsWith(applicationSettingsService.get().getPublicUrl())) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Could not subscribe to a feed from this CommaFeed instance");
|
||||||
|
}
|
||||||
|
|
||||||
Feed feed = feedService.findOrCreate(url);
|
Feed feed = feedService.findOrCreate(url);
|
||||||
|
|
||||||
FeedSubscription sub = feedSubscriptionDAO.findByFeed(user, feed);
|
FeedSubscription sub = feedSubscriptionDAO.findByFeed(user, feed);
|
||||||
|
|||||||
Reference in New Issue
Block a user