Add event type filters and custom message templates for I Done This.
Review Request #8961 — Created Oct. 18, 2017 and updated
This change provides some customization for messages posted to I Done This.
Event types can be filtered so that only some kinds of activity get posted,
while others do not. For example, the "Reply published" event can be disabled
to reduce noise in I Done This from every single reply getting published.The posted messages can also be customized independently for every event type.
An empty message causes a fallback to the default format string, which is shown
below the text field for reference. Parameters such as the review request ID,
summary, and URL are substituted into placeholder strings, or omitted from the
final message. The syntax for placeholders is fromstring.Template
, which is
limited and safer compared to other kinds of string formatting.New unit tests were added to verify the added functionality, and some existing
tests were updated to test individual event type filtering.
All unit tests pass.
Manually tested event type filtering. Choosing "All events" posts all activity
as before. Choosing a subset of event types only posts those events.Also specified some custom message template strings and verified that they get
formatted and posted to I Done This, or cause appropriate validation errors.
Description | From | Last Updated |
---|---|---|
I don't know that the word hash clarifies anything. |
brennie | |
Do we want to wrap the template strings with <code> e.g. <dt><code>...</code></dt> ? |
brennie | |
W503 line break before binary operator |
reviewbot | |
E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
You could just have entry_type=None in the arguments list instead of using kwargs.pop here. |
david | |
Needs the return type (unicode) |
david | |
Add a blank line after this. |
david | |
Instead of str(e), this should use six.text_type(e). You can get that by adding from django.utils import six in the imports. |
david | |
str -> six.text_type. Also add a blank line after this. |
david | |
Can we rewrap this a bit? return [ RBIntegrationsExtension.instance.get_bundle_id( 'idonethis-integration-config-form-view'), ] |
david | |
This can be dedented 4 spaces (there's only ever one return value). |
david | |
Add a blank line after this. |
david | |
Add a trailing comma on this line? |
david | |
Add a blank line after this. |
david | |
Add a blank line after this. |
david | |
/** |
david | |
/** |
david | |
This should be in the imperative mood ("Render the view"). This also should have a: Returns: IDoneThisIntegrationConfigFormView: This object, for … |
david | |
If #id_events is a child of #content-main form (which I believe it should be), you can use this.$ for a … |
david | |
/** |
david | |
This coment should probably go above the if key.startswith line. |
david |
- Change Summary:
-
No longer a draft, ready for final review!
Added and updated unit tests, fixed some issues they uncovered.
Changed the template string documentation to use a table for layout. - Summary:
-
[DRAFT] Add event type filters and custom message templates for I Done This.Add event type filters and custom message templates for I Done This.
- Description:
-
This change provides some customization for messages posted to I Done This.
Event types can be filtered so that only some kinds of activity get posted,
while others do not. For example, the "Reply published" event can be disabled to reduce noise in I Done This from every single reply getting published. The posted messages can also be customized independently for every event type.
An empty message causes a fallback to the default format string, which is shown below the text field for reference. Parameters such as the review request ID, summary, and URL are substituted into placeholder strings, or omitted from the final message. The syntax for placeholders is from string.Template
, which islimited and safer compared to other kinds of string formatting. + + New unit tests were added to verify the added functionality, and some existing
+ tests were updated to test individual event type filtering. - Testing Done:
-
~ (Unit tests are not done in this draft yet)
~ All unit tests pass.
Manually tested event type filtering. Choosing "All events" posts all activity
as before. Choosing a subset of event types only posts those events. Also specified some custom message template strings and verified that they get
formatted and posted to I Done This, or cause appropriate validation errors. - Diff:
-
Revision 2 (+667 -21)
-
1_add_new-integration_config.png: Add new integration config2_events_field_required.png: Events field is required3_all_events_checked.png: Checking "All Events" disables other choices5_message_validation.png: Validation of template string placeholders - Added Files:
Checks run (2 succeeded)
-
These are pretty much all just trivial style issues.
-
-
-
-
Instead of
str(e)
, this should usesix.text_type(e)
. You can get that by addingfrom django.utils import six
in the imports. -
-
Can we rewrap this a bit?
return [ RBIntegrationsExtension.instance.get_bundle_id( 'idonethis-integration-config-form-view'), ]
-
-
-
-
-
-
-
-
This should be in the imperative mood ("Render the view").
This also should have a:
Returns: IDoneThisIntegrationConfigFormView: This object, for chaining.
-
If
#id_events
is a child of#content-main form
(which I believe it should be), you can usethis.$
for a more efficient query. -
- Change Summary:
-
Addressed David's comments.
- Commit:
-
e0204268bf5e4946c97738dc750453dd5691324d0c2a1cd434f1bbe365edbd277642d402af387ac9