Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1113,18 +1113,21 @@ func TestUpdateEntry(t *testing.T) {
ID: 1,
Title: "Example",
}
tags := []string{"digested", "digested-advertisement-false"}
client := NewClientWithOptions(
"http://mf",
WithHTTPClient(
newFakeHTTPClient(t, func(t *testing.T, req *http.Request) *http.Response {
expectRequest(t, http.MethodPut, "http://mf/v1/entries/1", nil, req)
expectFromJSON(t, req.Body, &EntryModificationRequest{
Title: &expected.Title,
Tags: &tags,
})
return jsonResponseFrom(t, http.StatusOK, http.Header{}, expected)
})))
res, err := client.UpdateEntryContext(t.Context(), 1, &EntryModificationRequest{
Title: &expected.Title,
Tags: &tags,
})
if err != nil {
t.Fatalf("Expected no error, got %v", err)
Expand Down
5 changes: 3 additions & 2 deletions client/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ type Entry struct {

// EntryModificationRequest represents a request to modify an entry.
type EntryModificationRequest struct {
Title *string `json:"title"`
Content *string `json:"content"`
Title *string `json:"title"`
Content *string `json:"content"`
Tags *[]string `json:"tags,omitempty"`
}

// Entries represents a list of entries.
Expand Down
3 changes: 2 additions & 1 deletion contrib/bruno/miniflux/Update entry.bru
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ auth:basic {
body:json {
{
"title": "New title",
"content": "Some text"
"content": "Some text",
"tags": ["digested", "digested-advertisement-false"]
}
}

Expand Down
47 changes: 47 additions & 0 deletions internal/api/api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io"
"math/rand/v2"
"os"
"reflect"
"strings"
"testing"

Expand Down Expand Up @@ -2689,6 +2690,52 @@ func TestUpdateEntryEndpoint(t *testing.T) {
if entry.Content != "New content" {
t.Errorf(`Invalid content, got %q`, entry.Content)
}

originalTitle := entry.Title
originalContent := entry.Content
tags := []string{" digested ", "digested-advertisement-false"}
updatedEntry, err = regularUserClient.UpdateEntry(result.Entries[0].ID, &miniflux.EntryModificationRequest{
Tags: &tags,
})
if err != nil {
t.Fatal(err)
}

expectedTags := []string{"digested", "digested-advertisement-false"}
if !reflect.DeepEqual(updatedEntry.Tags, expectedTags) {
t.Errorf(`Invalid tags, got %v`, updatedEntry.Tags)
}
if updatedEntry.Title != originalTitle {
t.Errorf(`Title should not change when only tags are updated, got %q`, updatedEntry.Title)
}
if updatedEntry.Content != originalContent {
t.Errorf(`Content should not change when only tags are updated, got %q`, updatedEntry.Content)
}

entry, err = regularUserClient.Entry(result.Entries[0].ID)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(entry.Tags, expectedTags) {
t.Errorf(`Invalid persisted tags, got %v`, entry.Tags)
}
if entry.Title != originalTitle {
t.Errorf(`Persisted title should not change when only tags are updated, got %q`, entry.Title)
}
if entry.Content != originalContent {
t.Errorf(`Persisted content should not change when only tags are updated, got %q`, entry.Content)
}

tags = []string{}
updatedEntry, err = regularUserClient.UpdateEntry(result.Entries[0].ID, &miniflux.EntryModificationRequest{
Tags: &tags,
})
if err != nil {
t.Fatal(err)
}
if len(updatedEntry.Tags) != 0 {
t.Errorf(`Expected tags to be cleared, got %v`, updatedEntry.Tags)
}
}

func TestToggleStarredEndpoint(t *testing.T) {
Expand Down
16 changes: 14 additions & 2 deletions internal/api/entry_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,24 @@ func (h *handler) updateEntryHandler(w http.ResponseWriter, r *http.Request) {
entryUpdateRequest.Content = &sanitizedContent
}

hasTitleOrContentUpdate := entryUpdateRequest.Title != nil || entryUpdateRequest.Content != nil
hasTagsUpdate := entryUpdateRequest.Tags != nil

entryUpdateRequest.Patch(entry)
if user.ShowReadingTime {
if hasTitleOrContentUpdate && user.ShowReadingTime {
entry.ReadingTime = readingtime.EstimateReadingTime(entry.Content, user.DefaultReadingSpeed, user.CJKReadingSpeed)
}

if err := h.store.UpdateEntryTitleAndContent(entry); err != nil {
if hasTagsUpdate {
if hasTitleOrContentUpdate {
err = h.store.UpdateEntryTitleContentAndTags(entry)
} else {
err = h.store.UpdateEntryTags(entry)
}
} else if hasTitleOrContentUpdate {
err = h.store.UpdateEntryTitleAndContent(entry)
}
if err != nil {
response.JSONServerError(w, r, err)
return
}
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/ar_SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "لا توجد نتائج لهذا البحث.",
"alert.no_shared_entry": "لا توجد مشاركات.",
"alert.no_tag_entry": "لا توجد مقالات تطابق هذا الوسم.",
"alert.no_tag": "لا يوجد وسم.",
"alert.no_unread_entry": "لا توجد مقالات غير مقروءة.",
"alert.no_user": "أنت المستخدم الوحيد.",
"alert.prefs_saved": "تم حفظ التفضيلات!",
Expand Down Expand Up @@ -477,6 +478,7 @@
"page.categories.feeds": "المصادر",
"page.categories.no_feed": "لا يوجد مصدر.",
"page.categories.title": "الفئات",
"page.tags.title": "الوسوم",
"page.categories_count": [
"%d فئة",
"فئة واحدة",
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Es gibt kein Ergebnis für diese Suche.",
"alert.no_shared_entry": "Es existieren derzeit keine geteilten Artikel.",
"alert.no_tag_entry": "Es gibt keine Artikel, die diesem Tag entsprechen.",
"alert.no_tag": "Es gibt kein Stichwort.",
"alert.no_unread_entry": "Es existiert kein ungelesener Artikel.",
"alert.no_user": "Sie sind der einzige Benutzer.",
"alert.prefs_saved": "Einstellungen gespeichert!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Abonnements",
"page.categories.no_feed": "Kein Abonnement.",
"page.categories.title": "Kategorien",
"page.tags.title": "Stichworte",
"page.categories_count": [
"%d Kategorie",
"%d Kategorien"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/el_EL.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Δεν υπάρχουν αποτελέσματα για αυτήν την αναζήτηση.",
"alert.no_shared_entry": "Δεν υπάρχει κοινόχρηστη καταχώρηση.",
"alert.no_tag_entry": "Δεν υπάρχουν αντικείμενα που να ταιριάζουν με αυτή την ετικέτα.",
"alert.no_tag": "Δεν υπάρχει ετικέτα.",
"alert.no_unread_entry": "Δεν υπάρχουν μη αναγνωσμένα άρθρα.",
"alert.no_user": "Είστε ο μόνος χρήστης.",
"alert.prefs_saved": "Οι προτιμήσεις αποθηκεύτηκαν!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Συνδρομές",
"page.categories.no_feed": "Καμία ροή.",
"page.categories.title": "Κατηγορίες",
"page.tags.title": "Ετικέτες",
"page.categories_count": [
"%d κατηγορία",
"%d κατηγορίες"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "There are no results for this search.",
"alert.no_shared_entry": "There is no shared entry.",
"alert.no_tag_entry": "There are no entries matching this tag.",
"alert.no_tag": "There is no tag.",
"alert.no_unread_entry": "There are no unread entries.",
"alert.no_user": "You are the only user.",
"alert.prefs_saved": "Preferences saved!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Feeds",
"page.categories.no_feed": "No feed.",
"page.categories.title": "Categories",
"page.tags.title": "Tags",
"page.categories_count": [
"%d category",
"%d categories"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "No hay resultados para esta búsqueda.",
"alert.no_shared_entry": "No hay artículos compartidos.",
"alert.no_tag_entry": "No hay artículos con esta etiqueta.",
"alert.no_tag": "No hay etiquetas.",
"alert.no_unread_entry": "No hay artículos sin leer.",
"alert.no_user": "Eres el único usuario.",
"alert.prefs_saved": "¡Las preferencias se han guardado!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Fuentes",
"page.categories.no_feed": "Sin fuente.",
"page.categories.title": "Categorías",
"page.tags.title": "Etiquetas",
"page.categories_count": [
"%d categoría",
"%d categorías"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/fi_FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Ei hakua vastaavia tuloksia.",
"alert.no_shared_entry": "Jaettua artikkelia ei ole.",
"alert.no_tag_entry": "Tätä tunnistetta vastaavia merkintöjä ei ole.",
"alert.no_tag": "Tunnisteita ei ole.",
"alert.no_unread_entry": "Ei ole lukemattomia artikkeleita.",
"alert.no_user": "Olet ainoa käyttäjä.",
"alert.prefs_saved": "Asetukset tallennettu!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Tilaukset",
"page.categories.no_feed": "Ei syötettä.",
"page.categories.title": "Kategoriat",
"page.tags.title": "Tunnisteet",
"page.categories_count": [
"%d kategoria",
"%d kategoriaa"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Il n'y a aucun résultat pour cette recherche.",
"alert.no_shared_entry": "Il n'y a pas d'article partagé.",
"alert.no_tag_entry": "Il n'y a aucun article correspondant à ce tag.",
"alert.no_tag": "Il n'y a aucun libellé.",
"alert.no_unread_entry": "Il n'y a rien de nouveau à lire.",
"alert.no_user": "Vous êtes le seul utilisateur.",
"alert.prefs_saved": "Préférences sauvegardées !",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Abonnements",
"page.categories.no_feed": "Aucun abonnement.",
"page.categories.title": "Catégories",
"page.tags.title": "Libellés",
"page.categories_count": [
"%d catégorie",
"%d catégories"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/gl_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Non hai resultados para esta busca.",
"alert.no_shared_entry": "Non hai artigos compartidos.",
"alert.no_tag_entry": "Non hai artigos con esta etiqueta.",
"alert.no_tag": "Non hai etiquetas.",
"alert.no_unread_entry": "Non hai artigos sen ler.",
"alert.no_user": "Es a única conta usuaria.",
"alert.prefs_saved": "Gardáronse as preferencias!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Canles",
"page.categories.no_feed": "No hai canles.",
"page.categories.title": "Categorías",
"page.tags.title": "Etiquetas",
"page.categories_count": [
"%d categoría",
"%d categorías"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/hi_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "इस खोज के लिए कोई परिणाम नहीं हैं।",
"alert.no_shared_entry": "कोई साझा प्रविष्टि नहीं है",
"alert.no_tag_entry": "इस टैग से मेल खाती कोई प्रविष्टियाँ नहीं हैं।",
"alert.no_tag": "कोई टैग नहीं है।",
"alert.no_unread_entry": "कोई अपठित वस्तुत नहीं है।",
"alert.no_user": "आप एकमात्र उपयोगकर्ता हैं।",
"alert.prefs_saved": "प्राथमिकताएं सहेजी गईं!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "सदस्यता ले",
"page.categories.no_feed": "कोई फ़ीड नहीं है।",
"page.categories.title": "श्रेणियाँ",
"page.tags.title": "टैग",
"page.categories_count": [
"%d श्रेणी",
"%d श्रेणियाँ"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/id_ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Tidak ada hasil untuk pencarian ini.",
"alert.no_shared_entry": "Tidak ada entri yang dibagikan.",
"alert.no_tag_entry": "Tidak ada entri yang cocok dengan tag ini.",
"alert.no_tag": "Tidak ada tanda.",
"alert.no_unread_entry": "Belum ada artikel yang dibaca.",
"alert.no_user": "Anda adalah satu-satunya pengguna.",
"alert.prefs_saved": "Preferensi disimpan!",
Expand Down Expand Up @@ -457,6 +458,7 @@
"page.categories.feeds": "Langganan",
"page.categories.no_feed": "Tidak ada umpan.",
"page.categories.title": "Kategori",
"page.tags.title": "Tanda",
"page.categories_count": [
"%d kategori"
],
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "La ricerca non ha prodotto risultati.",
"alert.no_shared_entry": "Non ci sono voci condivise.",
"alert.no_tag_entry": "Non ci sono voci corrispondenti a questo tag.",
"alert.no_tag": "Non ci sono tag.",
"alert.no_unread_entry": "Nessun articolo da leggere.",
"alert.no_user": "Tu sei l'unico utente.",
"alert.prefs_saved": "Preferenze salvate!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Abbonamenti",
"page.categories.no_feed": "Nessun feed.",
"page.categories.title": "Categorie",
"page.tags.title": "Tag",
"page.categories_count": [
"%d categoria",
"%d categorie"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "検索で何も見つかりませんでした。",
"alert.no_shared_entry": "共有エントリはありません。",
"alert.no_tag_entry": "このタグに一致するエントリーはありません。",
"alert.no_tag": "タグはありません。",
"alert.no_unread_entry": "未読の記事はありません。",
"alert.no_user": "あなたが唯一のユーザーです。",
"alert.prefs_saved": "設定情報は保存されました!",
Expand Down Expand Up @@ -457,6 +458,7 @@
"page.categories.feeds": "フィード一覧",
"page.categories.no_feed": "フィードはありません。",
"page.categories.title": "カテゴリ",
"page.tags.title": "タグ",
"page.categories_count": [
"%d 件のカテゴリ"
],
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/nan_Latn_pehoeji.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Bô hû-ha̍p ê chhiau-chhē kiat-kó",
"alert.no_shared_entry": "Chit-má ah bô hun-hióng ê siau-sit",
"alert.no_tag_entry": "Bô kah chit ê khan-á ū hû-ha̍p ê siau-sit",
"alert.no_tag": "Bô khan-á.",
"alert.no_unread_entry": "Chit-má ah-bô tha̍k kè ê siau-sit",
"alert.no_user": "Lí sī ûi-it ê sú-iōng-lâng",
"alert.prefs_saved": "Siat-tēng í-keng pó-chûn--ah!",
Expand Down Expand Up @@ -457,6 +458,7 @@
"page.categories.feeds": "Siau-sit lâi-goân",
"page.categories.no_feed": "Ah-bô siau-sit lâi-goân",
"page.categories.title": "Lūi-pia̍t",
"page.tags.title": "Khan-á",
"page.categories_count": [
"%d ê lūi-pia̍t"
],
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/nl_NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Er is geen resultaat voor deze zoekopdracht.",
"alert.no_shared_entry": "Er is geen gedeeld artikel.",
"alert.no_tag_entry": "Er zijn geen artikelen die overeenkomen met deze tag.",
"alert.no_tag": "Er zijn geen labels.",
"alert.no_unread_entry": "Er zijn geen ongelezen artikelen.",
"alert.no_user": "Je bent de enige gebruiker.",
"alert.prefs_saved": "Instellingen opgeslagen!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Feeds",
"page.categories.no_feed": "Geen feed.",
"page.categories.title": "Categorieën",
"page.tags.title": "Labels",
"page.categories_count": [
"%d categorie",
"%d categorieën"
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Brak wyników tego wyszukiwania.",
"alert.no_shared_entry": "Brak udostępnionego wpisu.",
"alert.no_tag_entry": "Brak wpisów pasujących do tego znacznika.",
"alert.no_tag": "Brak znaczników.",
"alert.no_unread_entry": "Nie ma żadnych nieprzeczytanych wpisów.",
"alert.no_user": "Jesteś jedynym użytkownikiem.",
"alert.prefs_saved": "Ustawienia zapisane!",
Expand Down Expand Up @@ -465,6 +466,7 @@
"page.categories.feeds": "Kanały",
"page.categories.no_feed": "Brak kanałów.",
"page.categories.title": "Kategorie",
"page.tags.title": "Znaczniki",
"page.categories_count": [
"%d kategoria",
"%d kategorie",
Expand Down
2 changes: 2 additions & 0 deletions internal/locale/translations/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"alert.no_search_result": "Não há resultados para essa busca.",
"alert.no_shared_entry": "Não há itens compartilhados.",
"alert.no_tag_entry": "Não há itens que correspondam a esta etiqueta.",
"alert.no_tag": "Não há etiquetas.",
"alert.no_unread_entry": "Não há itens não lidos.",
"alert.no_user": "Você é o único usuário.",
"alert.prefs_saved": "Suas preferências foram salvas!",
Expand Down Expand Up @@ -461,6 +462,7 @@
"page.categories.feeds": "Inscrições",
"page.categories.no_feed": "Sem fonte.",
"page.categories.title": "Categorias",
"page.tags.title": "Etiquetas",
"page.categories_count": [
"%d categoria",
"%d categorias"
Expand Down
Loading