Add typing/modernizations to BaseChatIntegration and allow using emoji unicode blocks in chats.
Review Request #13749 — Created April 22, 2024 and submitted
This change mainly adds typing and modernizations to our chat integration
class. Additionally, we deprecate non-keyword arguments in most of their
methods for easier expansion in the future.We also give subclasses the option to use unicode blocks to represent
emojis in chat messages instead of shortcodes. This will be useful for the
upcoming Microsoft Teams integration, because Microsoft Teams can't interpret
emoji short codes.
Ran unit tests.
Summary | ID |
---|---|
47dd9d235220cc648fc75332e98e33be3fb669be |
Description | From | Last Updated |
---|---|---|
These are class properties, not constants, so they should be defined with lower case names. We should also type them … |
david | |
The base class should probably use integration-assets/chat-common/ |
david | |
We've generally avoided python's ternary form. Can we just do if/else for these? |
david | |
We can use type instead of Type. This should probably also be ClassVar[type[...]] |
david | |
Now that we changed the base class, this probably needs to override assets_base_url to point to the slack subdir. |
david | |
This is no longer correct. |
chipx86 | |
Can we make this a set? That'll be cheaper to look up file extensions in. |
chipx86 | |
Can we start moving this over to keyword-only arguments, and use housekeeping to deprecate? I think we're using the right … |
chipx86 | |
Same here. |
chipx86 | |
Same here, though we do have callers using review_request positionally. We can just make that positional and let everything else … |
chipx86 | |
line too long (81 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
line too long (84 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
This is an existing issue, but I noticed we have a space at the end and beginning of these strings, … |
chipx86 | |
Can you pull this out into a local variable? We access it a lot, here and below. |
chipx86 | |
Let's use Sequence instead of list, unless we need to mutate it. This solves some typing issues that can come … |
chipx86 | |
I'm curious, what happens if you try: return JSONDict( attachments=[attachment], icon_url=integrations.logo_url ) Does it still complain? Can I see the … |
chipx86 |
- Commits:
-
Summary ID 3790ad8b948122faa793f7a899742e8ecaaa8216 99daf99bb3cf4a226d309d7330370fcd452e038a - Diff:
-
Revision 2 (+828 -606)
Checks run (2 succeeded)
- Commits:
-
Summary ID 99daf99bb3cf4a226d309d7330370fcd452e038a 7a398c35998ced328712f5a1d3bd3f1950080487 - Diff:
-
Revision 3 (+834 -604)
Checks run (2 succeeded)
-
-
-
-
Can we start moving this over to keyword-only arguments, and use housekeeping to deprecate?
I think we're using the right things internally, so it should be a small change.
-
-
Same here, though we do have callers using
review_request
positionally. We can just make that positional and let everything else be a keyword-only argument.Maybe the rest of these, too. Work toward a better foundation for future expansion.
By the way, feel free to schedule these as separate changes. I don't want to hold this up unnecessarily.
- Change Summary:
-
- Make most arguments keyword only and add deprecation warnings.
- Add typing to the rest of the chat integration classes.
- Add a unit test for when slack attempts to send a notification when no webhookURL is configured.
- Description:
-
~ This change mainly adds typing and modernizations to the BaseChatIntegration
~ class, and cleans up some duplicate code in its subclasses. ~ This change mainly adds typing and modernizations to our chat integration
~ class. Additionally, we deprecate non-keyword arguments in most of their + methods for easier expansion in the future. We also give subclasses the option to use unicode blocks to represent
emojis in chat messages instead of shortcodes. This will be useful for the upcoming Microsoft Teams integration, because Microsoft Teams can't interpret emoji short codes. - Commits:
-
Summary ID 7a398c35998ced328712f5a1d3bd3f1950080487 0b0961f777f6c297bbbaaa1cb9a56c706ca63a92 - Diff:
-
Revision 4 (+1850 -974)
- Commits:
-
Summary ID 0b0961f777f6c297bbbaaa1cb9a56c706ca63a92 8287cc38c6d7d6e660f93004d5938460e49fe6f2 - Diff:
-
Revision 5 (+1858 -974)
Checks run (2 succeeded)
- Change Summary:
-
- Use "WebHook" consistently.
- Commits:
-
Summary ID 8287cc38c6d7d6e660f93004d5938460e49fe6f2 b8043da23577ec5c2ee5fe661fb7cb73e01dd076 - Diff:
-
Revision 6 (+1874 -990)
Checks run (2 succeeded)
-
-
This is an existing issue, but I noticed we have a space at the end and beginning of these strings, resulting in a double-space. Can you remove the leading space in the second string?
-
-
Let's use
Sequence
instead oflist
, unless we need to mutate it. This solves some typing issues that can come up (probably not here, but in other cases).Same in other cases.
- Commits:
-
Summary ID b8043da23577ec5c2ee5fe661fb7cb73e01dd076 43fe547f6061a1be30f0129470e901197fae7026 - Diff:
-
Revision 7 (+1912 -1008)
Checks run (2 succeeded)
- Commits:
-
Summary ID 43fe547f6061a1be30f0129470e901197fae7026 47dd9d235220cc648fc75332e98e33be3fb669be - Diff:
-
Revision 8 (+1912 -1008)