feat: support markdown_text parameter#1718
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1718 +/- ##
==========================================
+ Coverage 84.90% 84.91% +0.01%
==========================================
Files 113 113
Lines 12892 12895 +3
==========================================
+ Hits 10946 10950 +4
+ Misses 1946 1945 -1 ☔ View full report in Codecov by Sentry. |
zimeg
left a comment
There was a problem hiding this comment.
@WilliamBergamin LGTM! And thanks for keeping outputs relevant with these markdown formats 🎁
I left a few comments below but like where this PR moves things as is 👾
| link_names: Optional[bool] = None, | ||
| username: Optional[str] = None, | ||
| parse: Optional[str] = None, | ||
| markdown_text: Optional[str] = None, |
There was a problem hiding this comment.
I've added the
markdown_textargument in the methods definitions, but we could omit this since developers are able to pass this value through keyword arguments, should we explicitly define this argument?
praise: Adding this I think is a nice improvement for the typeahead hints found in some editors with virtual environments!
thought: It's nice to know that missing arguments aren't blocking new features though 🤖 ✨
slack_sdk/web/internal_utils.py
Outdated
| text = kwargs.get("text") | ||
| if text and len(text.strip()) > 0: | ||
| markdown_text = kwargs.get("markdown_text") | ||
| if (text and len(text.strip()) > 0) or (markdown_text and len(markdown_text.strip()) > 0): |
There was a problem hiding this comment.
suggestion(non-blocking): Separating these cases as separate if statements and returns might make later additions more clear 👁️🗨️
There was a problem hiding this comment.
Yess I agree let me see how this looks 💯
| self.assertEqual(warning_list, []) | ||
| self.assertIsNone(resp["error"]) |
There was a problem hiding this comment.
question(non-blocking): Do we want to keep the issue_### pattern or can we change this to something like:
tests/web/test_web_client_warnings.py
There was a problem hiding this comment.
Good point let me rename this 💯
zimeg
left a comment
There was a problem hiding this comment.
🧪 ✨ Awesome changes more with the testing updates and additions! Please do feel free to merge when the time is right.
Summary
#1713 reports that warnings are printed when the
markdown_textparameter is passed without thetextparameter, but passingtextalongsidemarkdown_textresults in an API errormarkdown_text_conflict😢 . This behavior affectschat_postMessage,chat_update,chat_scheduledMessageandchat_postEphemeralmethods.This PR aims to add support for the
markdown_textparameter by omitting warnings whenmarkdown_textis passed withouttextTesting
Use the following app to test the functionality
textargument should post a message as expected 🟢markdown_textargument should post a message as expected 🟢 no warningsmarkdown_textandtextarguments results in an API errormarkdown_text_conflictno_textFeedback
I've added the
markdown_textargument in the methods definitions, but we could omit this since developers are able to pass this value through keyword arguments, should we explicitly define this argument?Category
/docs(Documents)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.