aboutsummaryrefslogtreecommitdiffhomepage
path: root/storage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-04-29 17:43:40 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-04-29 17:43:40 -0700
commit31da4db14fdda364b1c72460a81e3ccce67ff7e8 (patch)
tree911808c77accb72d99ca4328b8d0907d0a36fdd4 /storage
parentb166ceaea72dc6db77467621ffc270fbdccb6566 (diff)
Do not show save link if no integration is configured
Diffstat (limited to 'storage')
-rw-r--r--storage/integration.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/storage/integration.go b/storage/integration.go
index 5a60d85..6a389de 100644
--- a/storage/integration.go
+++ b/storage/integration.go
@@ -176,3 +176,18 @@ func (s *Storage) CreateIntegration(userID int64) error {
return nil
}
+
+// HasSaveEntry returns true if the given user can save articles to third-parties.
+func (s *Storage) HasSaveEntry(userID int64) (result bool) {
+ query := `
+ SELECT true FROM integrations
+ WHERE user_id=$1 AND
+ (pinboard_enabled='t' OR instapaper_enabled='t' OR wallabag_enabled='t' OR nunux_keeper_enabled='t')
+ `
+
+ if err := s.db.QueryRow(query, userID).Scan(&result); err != nil {
+ result = false
+ }
+
+ return result
+}