-
Notifications
You must be signed in to change notification settings - Fork 939
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
cc/threads: fix a few more bugs #1685
Conversation
Signed-off-by: SoggySaussages <[email protected]>
Signed-off-by: SoggySaussages <[email protected]>
Signed-off-by: SoggySaussages <[email protected]>
Signed-off-by: SoggySaussages <[email protected]>
common/templates/context_funcs.go
Outdated
if duration < 60 || duration > 10080 { | ||
return nil, errors.New("createThread 'auto_archive_duration' must be and integer between 60 and 10080") | ||
start.AutoArchiveDuration = tmplToInt(opt) | ||
if start.AutoArchiveDuration < 60 || start.AutoArchiveDuration > 10080 { |
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 check exactly 60
, 1440
, 4320
, and 10080
, as stated in the thread metadata docs?
Currently giving any other value won't create the thread, with integers between 60 and 10080 failing silently.
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 this in 191fa78
, I've also added a designated type and constants for auto archive duration for readability in 283301f
.
Previously users could provide any integer between 60 and 10080 as a duration. This caused createThread or editThread to fail given that Discord only permits 60, 1440, 4320, *or* 10080. Now any non permissible value errors. Signed-off-by: SoggySaussages <[email protected]>
Signed-off-by: SoggySaussages <[email protected]>
* cc/threads: fix createThread archive duration Signed-off-by: SoggySaussages <[email protected]> * cc/threads: allow creation of news threads Signed-off-by: SoggySaussages <[email protected]> * discrdgo: ChannelType.IsThread ret true for news Signed-off-by: SoggySaussages <[email protected]> * cc/threads: error typo Signed-off-by: SoggySaussages <[email protected]> * cc/threads: restrict auto archive dur Previously users could provide any integer between 60 and 10080 as a duration. This caused createThread or editThread to fail given that Discord only permits 60, 1440, 4320, *or* 10080. Now any non permissible value errors. Signed-off-by: SoggySaussages <[email protected]> * discordgo: add type for auto archive Signed-off-by: SoggySaussages <[email protected]> --------- Signed-off-by: SoggySaussages <[email protected]>
* cc/threads: fix createThread archive duration Signed-off-by: SoggySaussages <[email protected]> * cc/threads: allow creation of news threads Signed-off-by: SoggySaussages <[email protected]> * discrdgo: ChannelType.IsThread ret true for news Signed-off-by: SoggySaussages <[email protected]> * cc/threads: error typo Signed-off-by: SoggySaussages <[email protected]> * cc/threads: restrict auto archive dur Previously users could provide any integer between 60 and 10080 as a duration. This caused createThread or editThread to fail given that Discord only permits 60, 1440, 4320, *or* 10080. Now any non permissible value errors. Signed-off-by: SoggySaussages <[email protected]> * discordgo: add type for auto archive Signed-off-by: SoggySaussages <[email protected]> --------- Signed-off-by: SoggySaussages <[email protected]>
Fix the following bugs:
Signed-off-by: SoggySaussages [email protected]