Add Mattermost chat integration.
Review Request #9361 — Created Nov. 10, 2017 and submitted
This change integrates Mattermost with Review Board, so that when there
is activity on review requests, a message will be sent to the configured
Mattermost channel with the details, just like Slack.
All existing rbintegrations unit tests pass for SlackIntegration. Added
similar unit tests for MattermostIntegration, which also pass.Manually tested navigating to the Integrations page on the UI. The new
form for Mattermost is displayed. Mattermost logo has been added, but
icon@2x needs to be created/uploaded still.
Description | From | Last Updated |
---|---|---|
I think you may have missed adding some files - I don't see the MattermostIntegration code in here, for example. … |
mike_conley | |
We also need an icon@2x.png file. |
david | |
All the files inside .idea shouldn't be part of your commit. |
david | |
You've still got this .idea file in the change. |
david | |
We should include module docstrings at the top of each new file (something like """Forms for chat integrations""") |
david | |
I don't think it was before, but this string should be wrapped in _() |
david | |
I don't think it was before, but this string should be wrapped in _() |
david | |
Module docstring. |
david | |
Shouldn't mention slack here. |
david | |
Shouldn't mention slack. |
david | |
These could all go on the same line. |
david | |
Shouldn't mention slack here. |
david | |
Shouldn't mention slack here. |
david | |
Hmm. This is probably something that we should have an abstract method for in basechat and specialize per subclass. |
david | |
Shouldn't mention slack here. |
david | |
Shouldn't mention slack here. |
david | |
Shouldn't mention slack here. |
david | |
Logging here shouldn't mention slack. |
david | |
Shouldn't mention slack here. |
david | |
Shouldn't mention slack here. |
david | |
Shouldn't mention slack here. |
david | |
Shouldn't mention slack here. |
david | |
We can just skip this entirely because the base class for all integrations defines it. |
david | |
Module docstring. |
david | |
Too many blank lines here. |
david | |
Not too many blank lines enough here. |
david | |
Because this is a property, we can document it like a property (just a single line `"""The icons used for … |
david | |
Module docstring |
david | |
Class docstring |
david | |
Don't need this blank line. |
david | |
Should include a docstring. |
david | |
Looks like we can just get rid of this file, no? |
david | |
Maybe mention that this is oriented towards Slack, but broken out of the integration class because other services (like Mattermost) … |
david | |
This argument should be called integration instead of self |
david | |
Perhaps just "configured channels"? I think it's definitely possible that other slack clones will pop up in the future. |
david | |
E265 block comment should start with '# ' |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
I think an argument needs a default value in order for it to be optional, I'm not seeing a default … |
bleblan2 | |
This import is coming from the same location as the line above, this can be updated to a single line … |
bleblan2 | |
There might be a good reason why this line was moved away from the django imports, but having the line … |
bleblan2 |
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+1469 -665) |
Checks run (2 succeeded)
-
Most of the stuff in your new "basechat" implementation is pretty Slack specific. This works because Mattermost tries to duplicate Slack's formatting very carefully, but that won't generalize to more services. I suspect what we want is to have the basechat integration set up all the handlers and create some kind of intermediate data structures, which the individual subclasses can then format into whatever is necessary. Because Mattermost borrows a lot from Slack, we could have utility code for that in the
slack/
module that Mattermost imports. -
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+3334 -627) |
Checks run (2 succeeded)
Summary: |
|
|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
-
-
-
-
rbintegrations/basechat/forms.py (Diff revision 3) We should include module docstrings at the top of each new file (something like
"""Forms for chat integrations"""
) -
rbintegrations/basechat/forms.py (Diff revision 3) I don't think it was before, but this string should be wrapped in
_()
-
rbintegrations/basechat/forms.py (Diff revision 3) I don't think it was before, but this string should be wrapped in
_()
-
-
-
-
-
-
-
rbintegrations/basechat/integration.py (Diff revision 3) Hmm. This is probably something that we should have an abstract method for in basechat and specialize per subclass.
-
-
-
-
-
-
-
-
-
rbintegrations/basechat/integration.py (Diff revision 3) We can just skip this entirely because the base class for all integrations defines it.
-
-
-
-
rbintegrations/mattermost/integration.py (Diff revision 3) Because this is a property, we can document it like a property (just a single line `"""The icons used for the integration.""")
-
-
-
-
-
-
rbintegrations/slack/integration.py (Diff revision 3) Maybe mention that this is oriented towards Slack, but broken out of the integration class because other services (like Mattermost) duplicate Slack APIs.
-
rbintegrations/slack/integration.py (Diff revision 3) This argument should be called
integration
instead ofself
-
rbintegrations/slack/integration.py (Diff revision 3) Perhaps just "configured channels"? I think it's definitely possible that other slack clones will pop up in the future.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+3407 -639) |
Checks run (1 failed, 1 succeeded)
flake8
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+3400 -639) |
Checks run (2 succeeded)
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+3425 -620) |
Checks run (1 failed, 1 succeeded)
flake8
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+3421 -620) |
Checks run (2 succeeded)
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+2513 -620) |
Checks run (2 succeeded)
-
-
rbintegrations/basechat/integration.py (Diff revision 8) I think an argument needs a default value in order for it to be optional, I'm not seeing a default value for
pre_text
orfallback_text
in the method declaration. -
rbintegrations/basechat/integration.py (Diff revision 8) If
fallback_text
is optional, I'm guessing that means it can be empty. If it is empty, the new value offallback_text
would have an extra:
in it. Might be worth adding extra logic for checking if fallback_text is empty and removing the extra:
. -
rbintegrations/basechat/integration.py (Diff revision 8) Same thing here with a possibly empty
fallback_text
getting passed in. -
rbintegrations/mattermost/integration.py (Diff revision 8) This import is coming from the same location as the line above, this can be updated to a single line with
from rbintegrations.slack.integration import utility_format_link, utility_notify
. -
rbintegrations/slack/integration.py (Diff revision 8) There might be a good reason why this line was moved away from the django imports, but having the line here doesn't follow the standard of having third party imports before local imports.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 9 (+2513 -620) |
Checks run (2 succeeded)
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 10 (+2511 -618) |