aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2019-07-26 21:13:06 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2019-07-26 21:24:15 -0700
commit3d19313a7f655bc2626990650c4de8141485eea3 (patch)
treec7fb0ade2b0f2eac2ae42067342df2e584ad230d
parent17aae725830cdd27131d40e20f3901d7da25e281 (diff)
Add option to disable feeds
-rw-r--r--api/payload.go5
-rw-r--r--api/payload_test.go27
-rw-r--r--database/migration.go2
-rw-r--r--database/sql.go2
-rw-r--r--database/sql/schema_version_24.sql1
-rw-r--r--locale/translations.go27
-rw-r--r--locale/translations/de_DE.json1
-rw-r--r--locale/translations/en_US.json1
-rw-r--r--locale/translations/es_ES.json1
-rw-r--r--locale/translations/fr_FR.json1
-rw-r--r--locale/translations/it_IT.json1
-rw-r--r--locale/translations/nl_NL.json1
-rw-r--r--locale/translations/pl_PL.json1
-rw-r--r--locale/translations/ru_RU.json1
-rw-r--r--locale/translations/zh_CN.json1
-rw-r--r--model/feed.go1
-rw-r--r--storage/feed.go40
-rw-r--r--storage/job.go10
-rw-r--r--template/html/edit_feed.html1
-rw-r--r--template/html/feeds.html1
-rw-r--r--template/views.go6
-rw-r--r--ui/feed_edit.go1
-rw-r--r--ui/form/feed.go3
-rw-r--r--ui/static/js/app.js4
24 files changed, 111 insertions, 29 deletions
diff --git a/api/payload.go b/api/payload.go
index 5acf0bb..011a516 100644
--- a/api/payload.go
+++ b/api/payload.go
@@ -50,6 +50,7 @@ type feedModification struct {
Username *string `json:"username"`
Password *string `json:"password"`
CategoryID *int64 `json:"category_id"`
+ Disabled *bool `json:"disabled"`
}
func (f *feedModification) Update(feed *model.Feed) {
@@ -92,6 +93,10 @@ func (f *feedModification) Update(feed *model.Feed) {
if f.CategoryID != nil && *f.CategoryID > 0 {
feed.Category.ID = *f.CategoryID
}
+
+ if f.Disabled != nil {
+ feed.Disabled = *f.Disabled
+ }
}
type userModification struct {
diff --git a/api/payload_test.go b/api/payload_test.go
index f890fe6..fe52ed1 100644
--- a/api/payload_test.go
+++ b/api/payload_test.go
@@ -138,6 +138,33 @@ func TestUpdateFeedUsernameWhenNotSet(t *testing.T) {
}
}
+func TestUpdateFeedDisabled(t *testing.T) {
+ valueTrue := true
+ valueFalse := false
+ scenarios := []struct {
+ changes *feedModification
+ feed *model.Feed
+ expected bool
+ }{
+ {&feedModification{}, &model.Feed{Disabled: true}, true},
+ {&feedModification{Disabled: &valueTrue}, &model.Feed{Disabled: true}, true},
+ {&feedModification{Disabled: &valueFalse}, &model.Feed{Disabled: true}, false},
+ {&feedModification{}, &model.Feed{Disabled: false}, false},
+ {&feedModification{Disabled: &valueTrue}, &model.Feed{Disabled: false}, true},
+ {&feedModification{Disabled: &valueFalse}, &model.Feed{Disabled: false}, false},
+ }
+
+ for _, scenario := range scenarios {
+ scenario.changes.Update(scenario.feed)
+ if scenario.feed.Disabled != scenario.expected {
+ t.Errorf(`Unexpected result, got %v, want: %v`,
+ scenario.feed.Disabled,
+ scenario.expected,
+ )
+ }
+ }
+}
+
func TestUpdateFeedCategory(t *testing.T) {
categoryID := int64(1)
changes := &feedModification{CategoryID: &categoryID}
diff --git a/database/migration.go b/database/migration.go
index b48fbf6..399c11b 100644
--- a/database/migration.go
+++ b/database/migration.go
@@ -12,7 +12,7 @@ import (
"miniflux.app/logger"
)
-const schemaVersion = 23
+const schemaVersion = 24
// Migrate executes database migrations.
func Migrate(db *sql.DB) {
diff --git a/database/sql.go b/database/sql.go
index b7acfc5..c8d7042 100644
--- a/database/sql.go
+++ b/database/sql.go
@@ -147,6 +147,7 @@ create index document_vectors_idx on entries using gin(document_vectors);`,
"schema_version_21": `alter table feeds add column user_agent text default '';`,
"schema_version_22": `update entries set document_vectors = setweight(to_tsvector(substring(coalesce(title, '') for 1000000)), 'A') || setweight(to_tsvector(substring(coalesce(content, '') for 1000000)), 'B');`,
"schema_version_23": `alter table users add column keyboard_shortcuts boolean default 't';`,
+ "schema_version_24": `alter table feeds add column disabled boolean default 'f';`,
"schema_version_3": `create table tokens (
id text not null,
value text not null,
@@ -198,6 +199,7 @@ var SqlMapChecksums = map[string]string{
"schema_version_21": "77da01ee38918ff4fe33985fbb20ed3276a717a7584c2ca9ebcf4d4ab6cb6910",
"schema_version_22": "51ed5fbcae9877e57274511f0ef8c61d254ebd78dfbcbc043a2acd30f4c93ca3",
"schema_version_23": "cb3512d328436447f114e305048c0daa8af7505cfe5eab02778b0de1156081b2",
+ "schema_version_24": "1224754c5b9c6b4038599852bbe72656d21b09cb018d3970bd7c00f0019845bf",
"schema_version_3": "a54745dbc1c51c000f74d4e5068f1e2f43e83309f023415b1749a47d5c1e0f12",
"schema_version_4": "216ea3a7d3e1704e40c797b5dc47456517c27dbb6ca98bf88812f4f63d74b5d9",
"schema_version_5": "46397e2f5f2c82116786127e9f6a403e975b14d2ca7b652a48cd1ba843e6a27c",
diff --git a/database/sql/schema_version_24.sql b/database/sql/schema_version_24.sql
new file mode 100644
index 0000000..be43450
--- /dev/null
+++ b/database/sql/schema_version_24.sql
@@ -0,0 +1 @@
+alter table feeds add column disabled boolean default 'f'; \ No newline at end of file
diff --git a/locale/translations.go b/locale/translations.go
index 1d18e63..7eae8aa 100644
--- a/locale/translations.go
+++ b/locale/translations.go
@@ -209,6 +209,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Standardbenutzeragenten überschreiben",
"form.feed.label.scraper_rules": "Extraktionsregeln",
"form.feed.label.rewrite_rules": "Umschreiberegeln",
+ "form.feed.label.disabled": "Aktualisieren Sie diesen Feed nicht",
"form.category.label.title": "Titel",
"form.user.label.username": "Benutzername",
"form.user.label.password": "Passwort",
@@ -503,6 +504,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Override Default User Agent",
"form.feed.label.scraper_rules": "Scraper Rules",
"form.feed.label.rewrite_rules": "Rewrite Rules",
+ "form.feed.label.disabled": "Do not refresh this feed",
"form.category.label.title": "Title",
"form.user.label.username": "Username",
"form.user.label.password": "Password",
@@ -777,6 +779,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Invalidar el agente de usuario predeterminado",
"form.feed.label.scraper_rules": "Reglas de raspador",
"form.feed.label.rewrite_rules": "Reglas de reescribir",
+ "form.feed.label.disabled": "No actualice este feed",
"form.category.label.title": "Título",
"form.user.label.username": "Nombre de usuario",
"form.user.label.password": "Contraseña",
@@ -1051,6 +1054,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Remplacer l'agent utilisateur par défaut",
"form.feed.label.scraper_rules": "Règles pour récupérer le contenu original",
"form.feed.label.rewrite_rules": "Règles de réécriture",
+ "form.feed.label.disabled": "Ne pas actualiser ce flux",
"form.category.label.title": "Titre",
"form.user.label.username": "Nom d'utilisateur",
"form.user.label.password": "Mot de passe",
@@ -1345,6 +1349,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Usa user agent personalizzato",
"form.feed.label.scraper_rules": "Regole di estrazione del contenuto",
"form.feed.label.rewrite_rules": "Regole di impaginazione del contenuto",
+ "form.feed.label.disabled": "Non aggiornare questo feed",
"form.category.label.title": "Titolo",
"form.user.label.username": "Nome utente",
"form.user.label.password": "Password",
@@ -1619,6 +1624,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Standaard User Agent overschrijven",
"form.feed.label.scraper_rules": "Scraper regels",
"form.feed.label.rewrite_rules": "Rewrite regels",
+ "form.feed.label.disabled": "Vernieuw deze feed niet",
"form.category.label.title": "Naam",
"form.user.label.username": "Gebruikersnaam",
"form.user.label.password": "Wachtwoord",
@@ -1913,6 +1919,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Zastąp domyślny agent użytkownika",
"form.feed.label.scraper_rules": "Zasady ekstrakcji",
"form.feed.label.rewrite_rules": "Reguły zapisu",
+ "form.feed.label.disabled": "Не обновлять этот канал",
"form.category.label.title": "Tytuł",
"form.user.label.username": "Nazwa użytkownika",
"form.user.label.password": "Hasło",
@@ -2213,6 +2220,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "Переопределить User Agent по умолчанию",
"form.feed.label.scraper_rules": "Правила Scraper",
"form.feed.label.rewrite_rules": "Правила Rewrite",
+ "form.feed.label.disabled": "Не обновлять этот канал",
"form.category.label.title": "Название",
"form.user.label.username": "Имя пользователя",
"form.user.label.password": "Пароль",
@@ -2491,6 +2499,7 @@ var translations = map[string]string{
"form.feed.label.user_agent": "覆盖默认 User-Agent",
"form.feed.label.scraper_rules": "Scraper 规则",
"form.feed.label.rewrite_rules": "重写规则",
+ "form.feed.label.disabled": "请勿刷新此Feed",
"form.category.label.title": "标题",
"form.user.label.username": "用户名",
"form.user.label.password": "密码",
@@ -2574,13 +2583,13 @@ var translations = map[string]string{
}
var translationsChecksums = map[string]string{
- "de_DE": "113b5f099a990378c4d929cec236170ff16cddbbdf8f24c26112fde1ce0f19d3",
- "en_US": "5a5a1f1b16f4ba3ebcb32d44abd9345a0dd21085c44bf7a80da5b0632c33db44",
- "es_ES": "6f37983ba3c3558612ab2dac6a210931587986f426062383762259c616e32646",
- "fr_FR": "bb66ad1f6460f9ddc1ceb95af5c9f0d2e57db80cbea2f4938c8b9555b3244cf6",
- "it_IT": "36282ed96b3e7e90c50c4dc35edeccc5e79087d4d0f8d425ffb323bff63f3963",
- "nl_NL": "e3386b1c6756ee49b779241d34e84cd005dbe1c9ed4d30a93a5afc2645a2d32f",
- "pl_PL": "ec7104556cead2d673a1c6c8384b12496128f2a618e332a748d16c684bac516d",
- "ru_RU": "af4dbbe97a49ae2af33470f4605ddd1027f62d98c191da339c6cc518995ff323",
- "zh_CN": "5e9b0f3dd3d3aae78196ec763faf56099018bc232a684080cf60354dc2446cc0",
+ "de_DE": "d8679b1026dffcdefe9afe519562ec52078f072cedd64f589bddb2b083fe5887",
+ "en_US": "7333eb884f4b98b238e07730187342dbc17149c68fabcc73c60478d75b7aa3c8",
+ "es_ES": "32d094110fd92971fe20a0ac2c3cb15db6a6fb06dba94815d75cab00cf4b73e3",
+ "fr_FR": "dda1c84e1b970efa8c564d459365ee17ad256ce684d7a036b31da70b50266ab2",
+ "it_IT": "b9e7ec9ad3ddd3a439ce238b5dd189000501bf26905d24fbb84ee77703999543",
+ "nl_NL": "04fa292f0ee9d4e98c39ecb1df11965881034f26685afb0081026850347a3b1c",
+ "pl_PL": "734173b0ceadcb1386dfc98e730fef40282f45dd45c02ac918ae1bb4b7ec0c39",
+ "ru_RU": "d50e95a88aec5ff8d43d197eeaa294e3ed2009181901e9deaffe48f7aa560a26",
+ "zh_CN": "b27685df8ed3accb573ca1401f25077e5c26f1e3e98d96e07353876821d53835",
}
diff --git a/locale/translations/de_DE.json b/locale/translations/de_DE.json
index 0b7ec0c..de9ada3 100644
--- a/locale/translations/de_DE.json
+++ b/locale/translations/de_DE.json
@@ -204,6 +204,7 @@
"form.feed.label.user_agent": "Standardbenutzeragenten überschreiben",
"form.feed.label.scraper_rules": "Extraktionsregeln",
"form.feed.label.rewrite_rules": "Umschreiberegeln",
+ "form.feed.label.disabled": "Aktualisieren Sie diesen Feed nicht",
"form.category.label.title": "Titel",
"form.user.label.username": "Benutzername",
"form.user.label.password": "Passwort",
diff --git a/locale/translations/en_US.json b/locale/translations/en_US.json
index d4f67f9..72ec06d 100644
--- a/locale/translations/en_US.json
+++ b/locale/translations/en_US.json
@@ -204,6 +204,7 @@
"form.feed.label.user_agent": "Override Default User Agent",
"form.feed.label.scraper_rules": "Scraper Rules",
"form.feed.label.rewrite_rules": "Rewrite Rules",
+ "form.feed.label.disabled": "Do not refresh this feed",
"form.category.label.title": "Title",
"form.user.label.username": "Username",
"form.user.label.password": "Password",
diff --git a/locale/translations/es_ES.json b/locale/translations/es_ES.json
index 21a3eb7..dbfa9f4 100644
--- a/locale/translations/es_ES.json
+++ b/locale/translations/es_ES.json
@@ -204,6 +204,7 @@
"form.feed.label.user_agent": "Invalidar el agente de usuario predeterminado",
"form.feed.label.scraper_rules": "Reglas de raspador",
"form.feed.label.rewrite_rules": "Reglas de reescribir",
+ "form.feed.label.disabled": "No actualice este feed",
"form.category.label.title": "Título",
"form.user.label.username": "Nombre de usuario",
"form.user.label.password": "Contraseña",
diff --git a/locale/translations/fr_FR.json b/locale/translations/fr_FR.json
index cd0d5d9..cea78a2 100644
--- a/locale/translations/fr_FR.json
+++ b/locale/translations/fr_FR.json
@@ -204,6 +204,7 @@
"form.feed.label.user_agent": "Remplacer l'agent utilisateur par défaut",
"form.feed.label.scraper_rules": "Règles pour récupérer le contenu original",
"form.feed.label.rewrite_rules": "Règles de réécriture",
+ "form.feed.label.disabled": "Ne pas actualiser ce flux",
"form.category.label.title": "Titre",
"form.user.label.username": "Nom d'utilisateur",
"form.user.label.password": "Mot de passe",
diff --git a/locale/translations/it_IT.json b/locale/translations/it_IT.json
index c641678..c926c26 100644
--- a/locale/translations/it_IT.json
+++ b/locale/translations/it_IT.json
@@ -204,6 +204,7 @@
"form.feed.label.user_agent": "Usa user agent personalizzato",
"form.feed.label.scraper_rules": "Regole di estrazione del contenuto",
"form.feed.label.rewrite_rules": "Regole di impaginazione del contenuto",
+ "form.feed.label.disabled": "Non aggiornare questo feed",
"form.category.label.title": "Titolo",
"form.user.label.username": "Nome utente",
"form.user.label.password": "Password",
diff --git a/locale/translations/nl_NL.json b/locale/translations/nl_NL.json
index 516d2be..4cd3252 100644
--- a/locale/translations/nl_NL.json
+++ b/locale/translations/nl_NL.json
@@ -204,6 +204,7 @@
"form.feed.label.user_agent": "Standaard User Agent overschrijven",
"form.feed.label.scraper_rules": "Scraper regels",
"form.feed.label.rewrite_rules": "Rewrite regels",
+ "form.feed.label.disabled": "Vernieuw deze feed niet",
"form.category.label.title": "Naam",
"form.user.label.username": "Gebruikersnaam",
"form.user.label.password": "Wachtwoord",
diff --git a/locale/translations/pl_PL.json b/locale/translations/pl_PL.json
index f0162a1..f3b9b95 100644
--- a/locale/translations/pl_PL.json
+++ b/locale/translations/pl_PL.json
@@ -206,6 +206,7 @@
"form.feed.label.user_agent": "Zastąp domyślny agent użytkownika",
"form.feed.label.scraper_rules": "Zasady ekstrakcji",
"form.feed.label.rewrite_rules": "Reguły zapisu",
+ "form.feed.label.disabled": "Не обновлять этот канал",
"form.category.label.title": "Tytuł",
"form.user.label.username": "Nazwa użytkownika",
"form.user.label.password": "Hasło",
diff --git a/locale/translations/ru_RU.json b/locale/translations/ru_RU.json
index 219cd34..17b2842 100644
--- a/locale/translations/ru_RU.json
+++ b/locale/translations/ru_RU.json
@@ -206,6 +206,7 @@
"form.feed.label.user_agent": "Переопределить User Agent по умолчанию",
"form.feed.label.scraper_rules": "Правила Scraper",
"form.feed.label.rewrite_rules": "Правила Rewrite",
+ "form.feed.label.disabled": "Не обновлять этот канал",
"form.category.label.title": "Название",
"form.user.label.username": "Имя пользователя",
"form.user.label.password": "Пароль",
diff --git a/locale/translations/zh_CN.json b/locale/translations/zh_CN.json
index c1e5f56..baca60a 100644
--- a/locale/translations/zh_CN.json
+++ b/locale/translations/zh_CN.json
@@ -202,6 +202,7 @@
"form.feed.label.user_agent": "覆盖默认 User-Agent",
"form.feed.label.scraper_rules": "Scraper 规则",
"form.feed.label.rewrite_rules": "重写规则",
+ "form.feed.label.disabled": "请勿刷新此Feed",
"form.category.label.title": "标题",
"form.user.label.username": "用户名",
"form.user.label.password": "密码",
diff --git a/model/feed.go b/model/feed.go
index 63957c6..4b67cb1 100644
--- a/model/feed.go
+++ b/model/feed.go
@@ -29,6 +29,7 @@ type Feed struct {
UserAgent string `json:"user_agent"`
Username string `json:"username"`
Password string `json:"password"`
+ Disabled bool `json:"disabled"`
Category *Category `json:"category,omitempty"`
Entries Entries `json:"entries,omitempty"`
Icon *FeedIcon `json:"icon"`
diff --git a/storage/feed.go b/storage/feed.go
index 5c2df83..17b37ff 100644
--- a/storage/feed.go
+++ b/storage/feed.go
@@ -59,7 +59,7 @@ func (s *Storage) Feeds(userID int64) (model.Feeds, error) {
f.user_id, f.checked_at at time zone u.timezone,
f.parsing_error_count, f.parsing_error_msg,
f.scraper_rules, f.rewrite_rules, f.crawler, f.user_agent,
- f.username, f.password,
+ f.username, f.password, f.disabled,
f.category_id, c.title as category_title,
fi.icon_id,
u.timezone
@@ -99,6 +99,7 @@ func (s *Storage) Feeds(userID int64) (model.Feeds, error) {
&feed.UserAgent,
&feed.Username,
&feed.Password,
+ &feed.Disabled,
&feed.Category.ID,
&feed.Category.Title,
&iconID,
@@ -133,7 +134,7 @@ func (s *Storage) FeedByID(userID, feedID int64) (*model.Feed, error) {
f.user_id, f.checked_at at time zone u.timezone,
f.parsing_error_count, f.parsing_error_msg,
f.scraper_rules, f.rewrite_rules, f.crawler, f.user_agent,
- f.username, f.password,
+ f.username, f.password, f.disabled,
f.category_id, c.title as category_title,
fi.icon_id,
u.timezone
@@ -160,6 +161,7 @@ func (s *Storage) FeedByID(userID, feedID int64) (*model.Feed, error) {
&feed.UserAgent,
&feed.Username,
&feed.Password,
+ &feed.Disabled,
&feed.Category.ID,
&feed.Category.Title,
&iconID,
@@ -185,8 +187,10 @@ func (s *Storage) FeedByID(userID, feedID int64) (*model.Feed, error) {
func (s *Storage) CreateFeed(feed *model.Feed) error {
sql := `
INSERT INTO feeds
- (feed_url, site_url, title, category_id, user_id, etag_header, last_modified_header, crawler, user_agent, username, password)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
+ (feed_url, site_url, title, category_id, user_id, etag_header,
+ last_modified_header, crawler, user_agent, username, password,
+ disabled)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
RETURNING id
`
@@ -203,6 +207,7 @@ func (s *Storage) CreateFeed(feed *model.Feed) error {
feed.UserAgent,
feed.Username,
feed.Password,
+ feed.Disabled,
).Scan(&feed.ID)
if err != nil {
return fmt.Errorf("unable to create feed %q: %v", feed.FeedURL, err)
@@ -222,11 +227,27 @@ func (s *Storage) CreateFeed(feed *model.Feed) error {
// UpdateFeed updates an existing feed.
func (s *Storage) UpdateFeed(feed *model.Feed) (err error) {
- query := `UPDATE feeds SET
- feed_url=$1, site_url=$2, title=$3, category_id=$4, etag_header=$5, last_modified_header=$6, checked_at=$7,
- parsing_error_msg=$8, parsing_error_count=$9, scraper_rules=$10, rewrite_rules=$11, crawler=$12, user_agent=$13,
- username=$14, password=$15
- WHERE id=$16 AND user_id=$17`
+ query := `
+ UPDATE feeds SET
+ feed_url=$1,
+ site_url=$2,
+ title=$3,
+ category_id=$4,
+ etag_header=$5,
+ last_modified_header=$6,
+ checked_at=$7,
+ parsing_error_msg=$8,
+ parsing_error_count=$9,
+ scraper_rules=$10,
+ rewrite_rules=$11,
+ crawler=$12,
+ user_agent=$13,
+ username=$14,
+ password=$15,
+ disabled=$16
+ WHERE
+ id=$17 AND user_id=$18
+ `
_, err = s.db.Exec(query,
feed.FeedURL,
@@ -244,6 +265,7 @@ func (s *Storage) UpdateFeed(feed *model.Feed) (err error) {
feed.UserAgent,
feed.Username,
feed.Password,
+ feed.Disabled,
feed.ID,
feed.UserID,
)
diff --git a/storage/job.go b/storage/job.go
index e115533..c231c97 100644
--- a/storage/job.go
+++ b/storage/job.go
@@ -18,8 +18,9 @@ func (s *Storage) NewBatch(batchSize int) (jobs model.JobList, err error) {
SELECT
id, user_id
FROM feeds
- WHERE parsing_error_count < $1
- ORDER BY checked_at ASC LIMIT %d`
+ WHERE parsing_error_count < $1 AND disabled is false
+ ORDER BY checked_at ASC LIMIT %d
+ `
return s.fetchBatchRows(fmt.Sprintf(query, batchSize), maxParsingError)
}
@@ -32,8 +33,9 @@ func (s *Storage) NewUserBatch(userID int64, batchSize int) (jobs model.JobList,
SELECT
id, user_id
FROM feeds
- WHERE user_id=$1
- ORDER BY checked_at ASC LIMIT %d`
+ WHERE user_id=$1 AND disabled is false
+ ORDER BY checked_at ASC LIMIT %d
+ `
return s.fetchBatchRows(fmt.Sprintf(query, batchSize), userID)
}
diff --git a/template/html/edit_feed.html b/template/html/edit_feed.html
index 73a2e27..da393b5 100644
--- a/template/html/edit_feed.html
+++ b/template/html/edit_feed.html
@@ -75,6 +75,7 @@
</select>
<label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "form.feed.label.crawler" }}</label>
+ <label><input type="checkbox" name="disabled" value="1" {{ if .form.Disabled }}checked{{ end }}> {{ t "form.feed.label.disabled" }}</label>
<div class="buttons">
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button> {{ t "action.or" }} <a href="{{ route "feeds" }}">{{ t "action.cancel" }}</a>
diff --git a/template/html/feeds.html b/template/html/feeds.html
index 7aac649..0bad59a 100644
--- a/template/html/feeds.html
+++ b/template/html/feeds.html
@@ -30,6 +30,7 @@
{{ if .Icon }}
<img src="{{ route "icon" "iconID" .Icon.IconID }}" width="16" height="16" alt="{{ .Title }}">
{{ end }}
+ {{ if .Disabled }} 🚫 {{ end }}
<a href="{{ route "feedEntries" "feedID" .ID }}">{{ .Title }}</a>
</span>
<span class="category">
diff --git a/template/views.go b/template/views.go
index 69c8586..4f51dc2 100644
--- a/template/views.go
+++ b/template/views.go
@@ -496,6 +496,7 @@ var templateViewsMap = map[string]string{
</select>
<label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "form.feed.label.crawler" }}</label>
+ <label><input type="checkbox" name="disabled" value="1" {{ if .form.Disabled }}checked{{ end }}> {{ t "form.feed.label.disabled" }}</label>
<div class="buttons">
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button> {{ t "action.or" }} <a href="{{ route "feeds" }}">{{ t "action.cancel" }}</a>
@@ -830,6 +831,7 @@ var templateViewsMap = map[string]string{
{{ if .Icon }}
<img src="{{ route "icon" "iconID" .Icon.IconID }}" width="16" height="16" alt="{{ .Title }}">
{{ end }}
+ {{ if .Disabled }} 🚫 {{ end }}
<a href="{{ route "feedEntries" "feedID" .ID }}">{{ .Title }}</a>
</span>
<span class="category">
@@ -1461,11 +1463,11 @@ var templateViewsMapChecksums = map[string]string{
"create_category": "6b22b5ce51abf4e225e23a79f81be09a7fb90acb265e93a8faf9446dff74018d",
"create_user": "1e940be3afefc0a5c6273bbadcddc1e29811e9548e5227ac2adfe697ca5ce081",
"edit_category": "daf073d2944a180ce5aaeb80b597eb69597a50dff55a9a1d6cf7938b48d768cb",
- "edit_feed": "ab30c31a4385a7b16c54baa78bdcb93a57181ed1c5018ce097d7eb50673bb995",
+ "edit_feed": "34aa0d668b3ea1a1b5fa480c20cebeae729b37010af3bb915d2a9eed73d3b996",
"edit_user": "f4f99412ba771cfca2a2a42778b023b413c5494e9a287053ba8cf380c2865c5f",
"entry": "1626bf4dd3223b2f730865676162aa0a9f0a0e009cdea90f705230542922e0f4",
"feed_entries": "4bb6b96ba4d13dbaf22dcf6dd95ae36b6e5a0c99175d502865a164dc68fd4bae",
- "feeds": "31acc253c547a6cce5710d72a6f6b3b396162ecd5e5af295b2cf47c1ff55bd06",
+ "feeds": "d11fb629921e22bbf6d9ecb1adcc38922fafcee84f81c437abf47209544bd1c5",
"history_entries": "9763d2120cfaeb78d406fdc029197fed2f7cfa7682970eeedae82ae79be65519",
"import": "8349e47a783bb40d8e9248b4771656e5f006185e11079e1c4680dd52633420ed",
"integrations": "f85b4a48ab1fc13b8ca94bfbbc44bd5e8784f35b26a63ec32cbe82b96b45e008",
diff --git a/ui/feed_edit.go b/ui/feed_edit.go
index a195613..a01c8c9 100644
--- a/ui/feed_edit.go
+++ b/ui/feed_edit.go
@@ -51,6 +51,7 @@ func (h *handler) showEditFeedPage(w http.ResponseWriter, r *http.Request) {
CategoryID: feed.Category.ID,
Username: feed.Username,
Password: feed.Password,
+ Disabled: feed.Disabled,
}
sess := session.New(h.store, request.SessionID(r))
diff --git a/ui/form/feed.go b/ui/form/feed.go
index 0151ea6..1a04acf 100644
--- a/ui/form/feed.go
+++ b/ui/form/feed.go
@@ -24,6 +24,7 @@ type FeedForm struct {
CategoryID int64
Username string
Password string
+ Disabled bool
}
// ValidateModification validates FeedForm fields
@@ -48,6 +49,7 @@ func (f FeedForm) Merge(feed *model.Feed) *model.Feed {
feed.ParsingErrorMsg = ""
feed.Username = f.Username
feed.Password = f.Password
+ feed.Disabled = f.Disabled
return feed
}
@@ -69,5 +71,6 @@ func NewFeedForm(r *http.Request) *FeedForm {
CategoryID: int64(categoryID),
Username: r.FormValue("feed_username"),
Password: r.FormValue("feed_password"),
+ Disabled: r.FormValue("disabled") == "1",
}
}
diff --git a/ui/static/js/app.js b/ui/static/js/app.js
index f054cc0..cae1d45 100644
--- a/ui/static/js/app.js
+++ b/ui/static/js/app.js
@@ -118,10 +118,6 @@ function markPageAsRead() {
function handleEntryStatus(element) {
let currentEntry = findEntry(element);
if (currentEntry) {
- // The order is important here,
- // On the unread page, the read item will be hidden.
- // If "goToNextListItem" first, it may go to an item about to hide:
- // Imagine that user click 'mark as read' right below the '.current-item'
toggleEntryStatus(currentEntry);
if (isListView() && currentEntry.classList.contains('current-item')) {
goToNextListItem();