From 7b6c3b374097f09c781e06bcd59c55bb592f400c Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Tue, 14 Jul 2020 16:16:26 -0400 Subject: [PATCH] Don't allow users to set notes on local files --- ui/pager.go | 4 ++-- ui/stash.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/pager.go b/ui/pager.go index d780660..8265fc2 100644 --- a/ui/pager.go +++ b/ui/pager.go @@ -183,8 +183,8 @@ func pagerUpdate(msg tea.Msg, m pagerModel) (pagerModel, tea.Cmd) { return m, nil } case "m": - // Users can't set the note on news markdown - if m.currentDocument.markdownType == newsMarkdown { + // Users can only set the note on user-stashed markdown + if m.currentDocument.markdownType != userMarkdown { break } diff --git a/ui/stash.go b/ui/stash.go index ad66220..46aabf2 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -524,9 +524,9 @@ func stashPopulatedView(m stashModel) string { func stashHelpView(m stashModel) string { var ( - h []string - md = m.selectedMarkdown() - isNews = md != nil && md.markdownType == newsMarkdown + h []string + md = m.selectedMarkdown() + isStashed = md != nil && md.markdownType == userMarkdown ) if m.state == stashStateSettingNote { @@ -541,7 +541,7 @@ func stashHelpView(m stashModel) string { if m.paginator.TotalPages > 1 { h = append(h, "h/l, ←/→: page") } - if !isNews && len(m.markdowns) > 0 { + if isStashed && len(m.markdowns) > 0 { h = append(h, []string{"x: delete", "m: set memo"}...) } h = append(h, []string{"esc: exit"}...)