-
Notifications
You must be signed in to change notification settings - Fork 889
feat: add option to disable confirmation dialogs for bulk operations #4247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -370,6 +370,7 @@ | |||||
| "form.prefs.label.show_reading_time": "顯示文章的預計閱讀時間", | ||||||
| "form.prefs.label.theme": "主題", | ||||||
| "form.prefs.label.timezone": "時區", | ||||||
| "form.prefs.label.disable_bulk_operations_confirmations": "Disable confirmation prompts for bulk operations (mark all as read, mark page as read)", | ||||||
|
||||||
| "form.prefs.label.disable_bulk_operations_confirmations": "Disable confirmation prompts for bulk operations (mark all as read, mark page as read)", | |
| "form.prefs.label.disable_bulk_operations_confirmations": "停用大量操作的確認提示(全部標記為已讀、將本頁標記為已讀)", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,8 +41,9 @@ type User struct { | |
| MediaPlaybackRate float64 `json:"media_playback_rate"` | ||
| BlockFilterEntryRules string `json:"block_filter_entry_rules"` | ||
| KeepFilterEntryRules string `json:"keep_filter_entry_rules"` | ||
| AlwaysOpenExternalLinks bool `json:"always_open_external_links"` | ||
| OpenExternalLinksInNewTab bool `json:"open_external_links_in_new_tab"` | ||
| AlwaysOpenExternalLinks bool `json:"always_open_external_links"` | ||
| OpenExternalLinksInNewTab bool `json:"open_external_links_in_new_tab"` | ||
| DisableBulkOperationsConfirmations bool `json:"disable_bulk_operations_confirmations"` | ||
|
Comment on lines
+44
to
+46
|
||
| } | ||
|
|
||
| // UserCreationRequest represents the request to create a user. | ||
|
|
@@ -84,8 +85,9 @@ type UserModificationRequest struct { | |
| MediaPlaybackRate *float64 `json:"media_playback_rate"` | ||
| BlockFilterEntryRules *string `json:"block_filter_entry_rules"` | ||
| KeepFilterEntryRules *string `json:"keep_filter_entry_rules"` | ||
| AlwaysOpenExternalLinks *bool `json:"always_open_external_links"` | ||
| OpenExternalLinksInNewTab *bool `json:"open_external_links_in_new_tab"` | ||
| AlwaysOpenExternalLinks *bool `json:"always_open_external_links"` | ||
| OpenExternalLinksInNewTab *bool `json:"open_external_links_in_new_tab"` | ||
| DisableBulkOperationsConfirmations *bool `json:"disable_bulk_operations_confirmations"` | ||
|
Comment on lines
+88
to
+90
|
||
| } | ||
|
|
||
| // Patch updates the User object with the modification request. | ||
|
|
@@ -209,6 +211,10 @@ func (u *UserModificationRequest) Patch(user *User) { | |
| if u.OpenExternalLinksInNewTab != nil { | ||
| user.OpenExternalLinksInNewTab = *u.OpenExternalLinksInNewTab | ||
| } | ||
|
|
||
| if u.DisableBulkOperationsConfirmations != nil { | ||
| user.DisableBulkOperationsConfirmations = *u.DisableBulkOperationsConfirmations | ||
| } | ||
| } | ||
|
|
||
| // UseTimezone converts last login date to the given timezone. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package model | ||
|
|
||
| import ( | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestUserModificationRequestPatch(t *testing.T) { | ||
| user := &User{ | ||
| Username: "original", | ||
| Theme: "original_theme", | ||
| Language: "original_language", | ||
| Timezone: "original_timezone", | ||
| AlwaysOpenExternalLinks: false, | ||
| OpenExternalLinksInNewTab: false, | ||
| DisableBulkOperationsConfirmations: false, | ||
| } | ||
|
|
||
|
Comment on lines
+10
to
+20
|
||
| // Test patching DisableBulkOperationsConfirmations | ||
| trueValue := true | ||
| req := &UserModificationRequest{ | ||
| DisableBulkOperationsConfirmations: &trueValue, | ||
| } | ||
| req.Patch(user) | ||
|
|
||
| if !user.DisableBulkOperationsConfirmations { | ||
| t.Error("Expected DisableBulkOperationsConfirmations to be true after patch") | ||
| } | ||
|
|
||
| // Test that nil values don't modify the user | ||
| user2 := &User{ | ||
| Username: "original", | ||
| DisableBulkOperationsConfirmations: true, | ||
| } | ||
| req2 := &UserModificationRequest{} // All fields nil | ||
| req2.Patch(user2) | ||
|
|
||
| if user2.Username != "original" { | ||
| t.Error("Username should not change when not provided in request") | ||
| } | ||
| if !user2.DisableBulkOperationsConfirmations { | ||
| t.Error("DisableBulkOperationsConfirmations should remain true when not provided in request") | ||
| } | ||
|
|
||
| // Test patching false value | ||
| falseValue := false | ||
| user3 := &User{ | ||
| DisableBulkOperationsConfirmations: true, | ||
| } | ||
| req3 := &UserModificationRequest{ | ||
| DisableBulkOperationsConfirmations: &falseValue, | ||
| } | ||
| req3.Patch(user3) | ||
|
|
||
| if user3.DisableBulkOperationsConfirmations { | ||
| t.Error("Expected DisableBulkOperationsConfirmations to be false after patch") | ||
| } | ||
| } | ||
|
|
||
| func TestUserModificationRequestPatchMultipleFields(t *testing.T) { | ||
| user := &User{ | ||
| Username: "original_user", | ||
| Theme: "original_theme", | ||
| AlwaysOpenExternalLinks: false, | ||
| OpenExternalLinksInNewTab: false, | ||
| DisableBulkOperationsConfirmations: false, | ||
| } | ||
|
|
||
| newUsername := "new_user" | ||
| newTheme := "new_theme" | ||
| trueValue := true | ||
|
|
||
| req := &UserModificationRequest{ | ||
| Username: &newUsername, | ||
| Theme: &newTheme, | ||
| AlwaysOpenExternalLinks: &trueValue, | ||
| OpenExternalLinksInNewTab: &trueValue, | ||
| DisableBulkOperationsConfirmations: &trueValue, | ||
| } | ||
| req.Patch(user) | ||
|
|
||
| if user.Username != "new_user" { | ||
| t.Errorf("Expected Username to be 'new_user', got '%s'", user.Username) | ||
| } | ||
| if user.Theme != "new_theme" { | ||
| t.Errorf("Expected Theme to be 'new_theme', got '%s'", user.Theme) | ||
| } | ||
| if !user.AlwaysOpenExternalLinks { | ||
| t.Error("Expected AlwaysOpenExternalLinks to be true") | ||
| } | ||
| if !user.OpenExternalLinksInNewTab { | ||
| t.Error("Expected OpenExternalLinksInNewTab to be true") | ||
| } | ||
| if !user.DisableBulkOperationsConfirmations { | ||
| t.Error("Expected DisableBulkOperationsConfirmations to be true") | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new label is still in English in the Chinese locale file. Please provide a zh_CN translation (or, if English fallback is preferred, omit the key here and rely on the fallback mechanism, if supported by the i18n loader).