From 31da4db14fdda364b1c72460a81e3ccce67ff7e8 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 29 Apr 2018 17:43:40 -0700 Subject: Do not show save link if no integration is configured --- storage/integration.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'storage') 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 +} -- cgit v1.2.3