-
Notifications
You must be signed in to change notification settings - Fork 662
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 text optional in chat.postMessage arguments and add warn logging if it's missing #1173
Conversation
Note: If we do To prevent this, we should use generic type like that I think. |
Thanks a lot for taking the time to make this pull request 🙇 Can you check my comment in the issue? #1172 (comment) |
@seratch added warning logic 🤗 Can you check this? |
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.
Thanks for updating! Please check my comment.
packages/web-api/src/WebClient.ts
Outdated
* @param logger instance of we clients logger | ||
*/ | ||
function warnMissingTextArgument(method: string, logger: Logger, options?: WebAPICallOptions): void { | ||
const methodsWithOptionalText = ['chat.postMessage']; |
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.
Can you add other chat.* methods here like I implemented in Python SDK? https://github.com/slackapi/python-slack-sdk/pull/910/files
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.
Thank you for revieing!
added warning logic for other methods and updated test 😄
9c4fef4
to
9ae0812
Compare
@seratch Sorry for late response. I forgot to mention you 🙇 Can you check the new changes? |
const methodsWithOptionalText = ['chat.postEphemeral', 'chat.postMessage', 'chat.scheduleMessage', 'chat.update']; | ||
const isNeededToCheckMethod = methodsWithOptionalText.includes(method); | ||
|
||
const isEmptyText = (args: WebAPICallOptions) => |
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.
Sorry, the implementation I mentioned had lack of consideration for attachments
. Can you update this logic to check fallback
in the case of attachments
? Refer to slackapi/python-slack-sdk#966 for the logic.
@kentac55 Thanks for being patient here and updating the code for the attachments pattern! If you don't mind, could you rename the local variables like this? seratch@b963985 |
@seratch Sorry for late response 🙇 cherry-picked your commit 😃 |
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.
Thanks for working on this! The changes look great to me but I would like to have other maintainers' eyes before merging it.
OK, there is no concerns about this. Let me merge this PR. Thanks for your contribution! @kentac55 |
Summary
Made
text
property ofChatPostMessageArguments
optional.close: #1172
Requirements (place an
x
in each[ ]
)