mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix: address verified review findings (misc-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
2 files changed
+17
-1
No files matched your search
@@ -95,7 +95,11 @@ func (a *application) notificationCommand() *cobra.Command {
|
|||||||
return s.Mark(cmd.Context(), id, mark.status)
|
return s.Mark(cmd.Context(), id, mark.status)
|
||||||
}, func(item services.Notification) string { return fmt.Sprintf(mark.done, notificationLabel(item)) })
|
}, func(item services.Notification) string { return fmt.Sprintf(mark.done, notificationLabel(item)) })
|
||||||
}
|
}
|
||||||
what := notificationsWith(filters) + " " + s.where
|
what := notificationsWith(filters)
|
||||||
|
if !until.IsZero() {
|
||||||
|
what += " updated before " + until.Format("2006-01-02 15:04")
|
||||||
|
}
|
||||||
|
what += " " + s.where
|
||||||
if a.canPrompt() {
|
if a.canPrompt() {
|
||||||
if err := a.confirmAction(cmd, terminal.Confirmation{Prompt: fmt.Sprintf(mark.ask, what), DefaultYes: true}); err != nil {
|
if err := a.confirmAction(cmd, terminal.Confirmation{Prompt: fmt.Sprintf(mark.ask, what), DefaultYes: true}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -143,3 +143,15 @@ func TestNotificationMutationsReportWhatChanged(t *testing.T) {
|
|||||||
require.Contains(t, withoutANSI(out.String()), "Latest comment: bob\n\n Looks good to me\n\nView this pull request on Gitea: https://gitea.test/alice/project/pulls/17\n")
|
require.Contains(t, withoutANSI(out.String()), "Latest comment: bob\n\n Looks good to me\n\nView this pull request on Gitea: https://gitea.test/alice/project/pulls/17\n")
|
||||||
require.Equal(t, []string{"read"}, marks, "viewing marks an unread notification as read")
|
require.Equal(t, []string{"read"}, marks, "viewing marks an unread notification as read")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNotificationMarkAllNamesTheBeforeCutoff(t *testing.T) {
|
||||||
|
now := time.Date(2028, 2, 1, 12, 0, 0, 0, time.UTC)
|
||||||
|
server := newAuthenticatedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
_, _ = w.Write([]byte(`[]`))
|
||||||
|
}))
|
||||||
|
defer server.Close()
|
||||||
|
deps, _, diagnostics := serverDeps(t, server.URL)
|
||||||
|
deps.Now = func() time.Time { return now }
|
||||||
|
require.NoError(t, Execute(context.Background(), deps, []string{"notification", "mark-read", "--all", "--before=1h"}))
|
||||||
|
require.Contains(t, withoutANSI(diagnostics.String()), "No unread notifications updated before 2028-02-01 11:00 in your inbox")
|
||||||
|
}
|
||||||
Reference in new issue
Block a user