-
Notifications
You must be signed in to change notification settings - Fork 783
feat: Global Block & Keep filters #2677
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
Conversation
…es & KeepFilterEntryRules
a4ced07
to
95d4cfd
Compare
From a user perspective, I'm wondering if The syntax could be simplified:
instead of
I would make the field names explicit to avoid possible confusions: |
Ok will make the following changes:
|
Be specific with the field name rules
Completed making the changes @fguillot |
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.
I would trim the trailing line feeds and empty lines when fetching the form values. Otherwise, the end-user might get this validation error:
Invalid Block rule: rule #2 is missing a valid field name (Options: 'EntryTitle', 'EntryURL', 'EntryCommentsURL', 'EntryContent', 'EntryAuthor', 'EntryTag')
Actually that was the intention, no blank lines allowed. Allows for easily referring to a specific rule# (rule #2 = line number #2) I guess removing the last line feeds can make it a little more user friendly, excuse any remaining trailing lines @fguillot Any suggestions on how to remove only blank lines from the end of the textarea string. PS: Figured it out with a regex |
@fguillot Updated form to sanitize spaces and newlines after a valid keep/block rule |
@@ -213,14 +213,14 @@ func validateMediaPlaybackRate(mediaPlaybackRate float64) *locale.LocalizedError | |||
|
|||
func isValidFilterRules(filterEntryRules string, filterType string) *locale.LocalizedError { | |||
// Valid Format: FieldName(RegEx)~FieldName(RegEx)~... |
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.
Shouldn't this comment be updated?
906b2f1#diff-f3574e6be1fa37431084a6f395c2eca7e9b97578b4f91d0ceb6ad32ee0d03b39L218-R218
- rules := strings.Split(filterEntryRules, "~")
+ rules := strings.Split(filterEntryRules, "\n")
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.
Yes, will update.
I also had a dream last night about '\r\n' from windows.
Need to sanitize the string further.
Updating now
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.
Done, sent a new pull request #2726
Do you follow the guidelines?
Added new feature to enable Global Keep & Block Rules.
Advantages
Format:
FieldName(RegEx)~FieldName(RegEx)~...
FieldName
options:Title
,URL
,CommentsURL
,Content
,Author
,Tags
Addresses: #1326 , #1654 , #1953 , #2583 (maybe)