pubsubhubbub support is now optional

This commit is contained in:
Athou
2013-05-21 07:09:48 +02:00
parent 515cc4c0dd
commit 304218265f
3 changed files with 22 additions and 9 deletions

View File

@@ -15,6 +15,7 @@ import com.commafeed.backend.model.Feed;
import com.commafeed.backend.model.FeedEntry; import com.commafeed.backend.model.FeedEntry;
import com.commafeed.backend.model.FeedPushInfo; import com.commafeed.backend.model.FeedPushInfo;
import com.commafeed.backend.pubsubhubbub.SubscriptionHandler; import com.commafeed.backend.pubsubhubbub.SubscriptionHandler;
import com.commafeed.backend.services.ApplicationSettingsService;
import com.commafeed.backend.services.FeedUpdateService; import com.commafeed.backend.services.FeedUpdateService;
@Stateless @Stateless
@@ -32,13 +33,18 @@ public class FeedRefreshUpdater {
@Inject @Inject
FeedDAO feedDAO; FeedDAO feedDAO;
@Inject
ApplicationSettingsService applicationSettingsService;
@Asynchronous @Asynchronous
public void updateEntries(Feed feed, Collection<FeedEntry> entries) { public void updateEntries(Feed feed, Collection<FeedEntry> entries) {
if (CollectionUtils.isNotEmpty(entries)) { if (CollectionUtils.isNotEmpty(entries)) {
feedUpdateService.updateEntries(feed, entries); feedUpdateService.updateEntries(feed, entries);
} }
feedDAO.update(feed); feedDAO.update(feed);
handlePubSub(feed); if (applicationSettingsService.get().isPubsubhubbub()) {
handlePubSub(feed);
}
} }
private void handlePubSub(Feed feed) { private void handlePubSub(Feed feed) {

View File

@@ -15,24 +15,17 @@ import javax.xml.bind.annotation.XmlRootElement;
public class ApplicationSettings extends AbstractModel { public class ApplicationSettings extends AbstractModel {
private String publicUrl; private String publicUrl;
/**
* Wether registrations are open
*/
private boolean allowRegistrations = false; private boolean allowRegistrations = false;
private String googleAnalyticsTrackingCode; private String googleAnalyticsTrackingCode;
private String googleClientId; private String googleClientId;
private String googleClientSecret; private String googleClientSecret;
private int backgroundThreads = 3; private int backgroundThreads = 3;
private String smtpHost; private String smtpHost;
private int smtpPort; private int smtpPort;
private boolean smtpTls; private boolean smtpTls;
private String smtpUserName; private String smtpUserName;
private String smtpPassword; private String smtpPassword;
private boolean pubsubhubbub;
private boolean feedbackButton = true; private boolean feedbackButton = true;
@Column(length = 255) @Column(length = 255)
@@ -143,4 +136,12 @@ public class ApplicationSettings extends AbstractModel {
this.feedbackButton = feedbackButton; this.feedbackButton = feedbackButton;
} }
public boolean isPubsubhubbub() {
return pubsubhubbub;
}
public void setPubsubhubbub(boolean pubsubhubbub) {
this.pubsubhubbub = pubsubhubbub;
}
} }

View File

@@ -111,6 +111,12 @@
ng-model="settings.smtpPassword" /> ng-model="settings.smtpPassword" />
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label" for="pubsubhubbub">PubSubHubbub</label>
<div class="controls">
<input type="checkbox" name="pubsubhubbub" ng-model="settings.pubsubhubbub" />
</div>
</div>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">