• 
      

    Add event type filters and custom message templates for I Done This.

    Review Request #8961 — Created Oct. 18, 2017 and updated

    Information

    rbintegrations
    master
    e92b70c...

    Reviewers

    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 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 brennie

    Do we want to wrap the template strings with <code> e.g. <dt><code>...</code></dt> ?

    brennie brennie

    W503 line break before binary operator

    reviewbot reviewbot

    E251 unexpected spaces around keyword / parameter equals

    reviewbot reviewbot

    E251 unexpected spaces around keyword / parameter equals

    reviewbot reviewbot

    You could just have entry_type=None in the arguments list instead of using kwargs.pop here.

    david david

    Needs the return type (unicode)

    david david

    Add a blank line after this.

    david 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 david

    str -> six.text_type. Also add a blank line after this.

    david david

    Can we rewrap this a bit? return [ RBIntegrationsExtension.instance.get_bundle_id( 'idonethis-integration-config-form-view'), ]

    david david

    This can be dedented 4 spaces (there's only ever one return value).

    david david

    Add a blank line after this.

    david david

    Add a trailing comma on this line?

    david david

    Add a blank line after this.

    david david

    Add a blank line after this.

    david david

    /**

    david david

    /**

    david david

    This should be in the imperative mood ("Render the view"). This also should have a: Returns: IDoneThisIntegrationConfigFormView: This object, for …

    david 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

    /**

    david david

    This coment should probably go above the if key.startswith line.

    david david
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    brennie
    1. 
        
    2. Show all issues

      I don't know that the word hash clarifies anything.

      1. You're right, that's an implementation detail (in the API they are called hash_id). This really applies to the first review request, so I'll change it there.

    3. rbintegrations/idonethis/forms.py (Diff revision 1)
       
       
      Show all issues

      Do we want to wrap the template strings with <code> e.g. <dt><code>...</code></dt> ?

      1. Sure, it looks better that way. I also changed from dl to table to lay things out horizontally for clarity.

    4. 
        
    MU
    david
    1. These are pretty much all just trivial style issues.

    2. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      You could just have entry_type=None in the arguments list instead of using kwargs.pop here.

    3. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      Needs the return type (unicode)

    4. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      Add a blank line after this.

    5. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      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.

    6. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      str -> six.text_type. Also add a blank line after this.

    7. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
       
      Show all issues

      Can we rewrap this a bit?

      return [
          RBIntegrationsExtension.instance.get_bundle_id(
              'idonethis-integration-config-form-view'),
      ]
      
    8. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      This can be dedented 4 spaces (there's only ever one return value).

    9. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      Add a blank line after this.

    10. rbintegrations/idonethis/forms.py (Diff revision 2)
       
       
      Show all issues

      Add a trailing comma on this line?

    11. rbintegrations/idonethis/integration.py (Diff revision 2)
       
       
      Show all issues

      Add a blank line after this.

    12. rbintegrations/idonethis/tests.py (Diff revision 2)
       
       
      Show all issues

      Add a blank line after this.

    13. Show all issues

      /**

    14. Show all issues

      /**

    15. Show all issues

      This should be in the imperative mood ("Render the view").

      This also should have a:

      Returns:
          IDoneThisIntegrationConfigFormView:
          This object, for chaining.
      
      1. Some older files in Review Board also need to be updated :)
        I was using reviewboard/static/rb/js/admin/views/webhookFormView.js as a template for this functionality.

    16. Show all issues

      If #id_events is a child of #content-main form (which I believe it should be), you can use this.$ for a more efficient query.

    17. Show all issues

      /**

    18. 
        
    MU
    david
    1. One little nit left.

    2. rbintegrations/idonethis/forms.py (Diff revision 3)
       
       
      Show all issues

      This coment should probably go above the if key.startswith line.

    3. 
        
    MU
    Review request changed