prevent subscription to our own feeds

This commit is contained in:
Athou
2013-04-30 22:05:38 +02:00
parent 2d40c4292c
commit e01da0645d

View File

@@ -31,12 +31,21 @@ public class FeedSubscriptionService {
@Inject
FeedSubscriptionDAO feedSubscriptionDAO;
@Inject FeedRefreshTaskGiver taskGiver;
@Inject
ApplicationSettingsService applicationSettingsService;
@Inject
FeedRefreshTaskGiver taskGiver;
public Feed subscribe(User user, String url, String title,
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);
FeedSubscription sub = feedSubscriptionDAO.findByFeed(user, feed);