-
Notifications
You must be signed in to change notification settings - Fork 362
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
Make forum-post-cooldown
use auto-follow-topic
's logic
#7273
base: master
Are you sure you want to change the base?
Make forum-post-cooldown
use auto-follow-topic
's logic
#7273
Conversation
Co-authored-by: W_L <mundofinky@gmail.com>
export const onNonSuccessfulPost = (callback) => { | ||
if (hasTopic && !success) callback(topicID); |
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 still isn't convincing to me. Shouldn't this check for postError()
?
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.
postError()
is called when setting the success
variable.
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.
success
being true does guarantee there wasn't any post errors. However, success
being false tells us nothing about whether there was a post error or not. Again, how do we want to define a "non successful post"?
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.
A "non-succesful post" is a post that has been attempted to be posted by the user, but instead of it being posted, an error message was shown.
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.
The variable success
is true, if and only if, hasTopic && !postError()
is true
That is, !success
is true if either hasTopic
if false, postError()
is true, or both at the same time
To see if there's a non-successful post, you evaluate hasTopic && !success
.
But as said above, this is equivalent to hasTopic && (!hasTopic || postError())
Of course, hasTopic
cannot be true and false at the same time, so the condition you end up checking is hasTopic && postError()
So I guess your code is equivalent to what I would expect (I would need to check again), but I found it quite confusing!
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.
Should I just leave out the success
variable in favor of calling postError
directly?
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.
export const onNonSuccessfulPost = (callback) => { | |
if (hasTopic && !success) callback(topicID); | |
export const onNonSuccessfulPost = (callback) => { | |
if (postError()) callback(topicID); |
I guess this would work as you expect?
Resolves #6926
Probably resolves #7269
Resolves (possibly) #6914 (not sure about this one, I can't seem to replicate that issue even on stable)
Changes
Turn
auto-follow-topic
into a module, and makeforum-post-cooldown
use it.Reason for changes
Improving
forum-post-cooldown
.Tests
Tested in Edge.