-
-
-
-
reviewboard/reviews/models.py (Diff revision 1) Is there a need for the intermediate variable "action"? I know it looks better, but you can just attach .save to the Action() init.
-
-
-
reviewboard/reviews/models.py (Diff revision 1) the "review_published.send()" can be taken out of the if statement since it will be called anyway. So: verb = 'published a review' if self.is_reply(): verb = 'published a reply' reply_published.send(sender=self.__class__, user=user, reply=self)
-
-
-
reviewboard/reviews/views.py (Diff revision 1) I don't see why this import was removed, was it unused?
-
-
-
-
-
-
-
reviewboard/static/rb/css/action-feed.less (Diff revision 1) May I ask why you are using !important here?
-
-
-
-
-
-
reviewboard/templates/reviews/dashboard.html (Diff revision 1) indent "include" and "{{datagrid...}}"
[WIP] Action feed prototype using a separate table for storing actions
Review Request #3151 — Created June 19, 2012 and discarded
In the current stage, the action feed is the default dashboard view and it displays info related to [almost] any update to the requests the user has previously visited. The action-boxes contain the review request id and summary, the name of the user who performed the action and the type of action performed. Still to-do: * restyle the dashboard entries box * make the action boxes expandable and implement ajax calls to display their content
No tests yet - will start running them/ adding new ones once this is a bit more advanced.
Screenshots
Description | From | Last Updated |
---|---|---|
Alphabetical order. |
ME medanat | |
Alphabetical order. |
ME medanat | |
the "review_published.send()" can be taken out of the if statement since it will be called anyway. So: verb = 'published … |
ME medanat | |
intermediate variable again. |
ME medanat | |
I believe this fits on one line. |
ME medanat | |
Alphabetical order. |
ME medanat | |
Keep this empty line before the return. |
ME medanat | |
No need for this empty line. |
ME medanat | |
No need for this empty line. |
ME medanat | |
No need for this empty line. |
ME medanat | |
No need for this empty line. |
ME medanat | |
May I ask why you are using !important here? |
ME medanat | |
No need for those empty lines. |
ME medanat | |
No need for the empty lines here. |
ME medanat | |
Indent all by one. |
ME medanat | |
No need for this extra line. |
ME medanat | |
indent "compressed_css" |
ME medanat | |
indent "include" and "{{datagrid...}}" |
ME medanat | |
No need for space between 'view' and : |
ME medanat | |
Remove space before ':' |
ME medanat | |
Space after ':' |
ME medanat | |
Remove space before the ':'. |
ME medanat | |
Indent inside the '{%', not outside. i.e.: {% for {% if {% definevar ... {% endif {% endfor |
ME medanat | |
One more level of indentation here. |
ME medanat | |
Alphabetical order. |
ME medanat | |
No need for this empty line. |
ME medanat | |
Indent within the '{%'. |
ME medanat | |
Indent within the '{%'. |
ME medanat | |
Indent within the '{%'. |
ME medanat | |
Tiny optimization: _request = self.request Since self.request is being called three times within the method body. Less .'s means faster … |
ME medanat | |
Add an empty line here. |
ME medanat | |
Wouldn't it be easier to do this calculation before hand and leave the reasoning in a comment? i.e.: = 31536000 … |
ME medanat | |
Alphabetical order. |
ME medanat | |
Translate: Review request. Remove the trailing white space. |
ME medanat | |
You can shift the the {% %} logic all the way to the left. That saves on white space being … |
ME medanat | |
Translate: Posted. |
ME medanat | |
Translate: Updated. |
ME medanat | |
Translate: Ago. |
ME medanat | |
We're probably not doing great about alphabetical order here, but might as well place this above the others. |
|
|
Just for readability, put each parameter on its own line (and start with the Action.objects.create) line. |
|
|
Same as above. Actually, given that we do this twice, can we just set a couple common variables and then … |
|
|
Same here. |
|
|
Same here. Blank line after this. I prefer blank lines between blocks and other code (like around an if, for, … |
|
|
Was this intentional? It looks like a mistake. |
|
|
Same. |
|
|
Generally, (and I know a lot of older code doesn't do this), docs should be in this format: """One-line summary. … |
|
|
No blank line. |
|
|
Instead of this, do this above: @property def request_display_id(self): ... |
|
|
Are we expecting that the action feed will now be the default view? I'd be a little concerned about that, … |
|
|
No blank line. This should subclass from object. |
|
|
Can you document why we need this? |
|
|
In general, we should use "pk" instead of "id" when referring to the primary key of the model. Same with … |
|
|
Add a trailing comma. |
|
|
Alignment is off. |
|
|
Space before { |
|
|
All indentation should be 2 lines instead of 4. |
|
|
Another case of {. Same with others in this file. |
|
|
No blank line. |
|
|
No spaces around = |
|
|
One space indentation. |
|
|
No spaces inside {{..}} |
|
|
Let's go ahead and use 'action-feed'. '-' is nicer in URLs. |
|
|
No blank line. |
|
|
We should avoid queries on these objects. So instead, do: if self.review_id: return self.review_id elif self.changedesc_id: return self.changedesc_id This should … |
|
|
No blank line. |
|
|
Should also check review_id and changedesc_id, and return some default. |
|
|
action-feed. |
|
|
Add a trailing comma. |
|
|
local_site_id |
|
|
Indentation looks wrong. This map should only be defined once, outside the function. |
|
|
You should only have one var statement, formatted like: var body = ..., request_url = ...; |
|
|
Best as: var changeitems = $('') .appendTo(body); |
|
|
This var needs to also be before. In JavaScript, all variables when compiling in the VM are moved to the … |
|
|
One var statemnet. |
|
|
Best to append changeitem after you've completely populated it, at the end of the loop. |
|
|
Best done as: field_name = field_name_map[field] || field |
|
|
Should be: changeitem.append($('').text(field_name)); This will do the right thing if there are characters in field_name that need escaping (such as … |
|
|
In general, instead of 'in', it's best to do field_changed.hasOwnProperty('added'). The reason being that if anything were to populate the … |
|
|
Hmm, not sure what you're doing here? I don't know that an object for added/removed is correct. |
|
|
In JavaScript, always use braces. Given that we do field_changed[type] a lot, I would just pull that value out once … |
|
|
vars must be at the top of the scope. |
|
|
===. Avoids a cast. |
|
|
Build this with jQuery's methods to ensure there aren't HTML encoding issues. |
|
|
No blank line. |
|
|
Braces. Why the length check? |
|
|
One var, top of scope. |
|
|
No blank lines. For the field_changed length check, you'll want to pull the length out into a variable first. Saves … |
|
|
hasOwnProperty. |
|
|
Build with jQuery. |
|
|
hasOwnProperty. |
|
|
Build with jQuery. |
|
|
Blank line. |
|
|
hasOwnProperty. |
|
|
Alignment for multiline is wrong. Should use === for comparison. One set of var statements. |
|
|
Maybe oldValue/newValue? |
|
|
=== |
|
|
All this should be built with jQuery. |
|
|
=== Alignment is wrong. |
|
|
Move var out of the for, since it's really going to be promoted to the top of the "else if" … |
|
|
Build with jQuery. Make sure to always use braces. |
|
|
If so, maybe we should log that. |
|
|
Blank line. |
|
|
Build with jQuery. |
|
|
Blank line. |
|
|
Alignment is off. The whole function should build with jQuery. |
|
|
Same. |
|
|
One var. |
|
|
Same. |
|
|
Alignment is off. |
|
|
$('') .appendTo(body); |
|
|
One var. |
|
|
Move this into the declaration above, before my proposed appendTo. |
|
|
Move var up, and pull the length out. |
|
|
vars go first. comment can probably just be defined in each loop that needs it. |
|
|
Build with jQuery. These comments apply to everywhere else in the JavaScript. |
|
|
No blank line. |
|
|
No blank line. The resource needs a description. This will be auto-generated for our API docs page. Make sure to … |
|
|
I've noticed this a couple times now. Instead of repeating it, you should define a Manager class that the Action … |
|
|
You can combine these. |
|
|
You can do: if field in ('screenshot_captions, 'file_captions'): |
|
Change Summary:
Changes: Implemented Yazan's feedback. Added a request summary field to the actions table Join Action and ReviewRequestVisit tables (to only display updates for the requests the user visited) UI improvements (expandable boxes, Review request id and summary displayed on top, id links to the actual request, boxes colored different for reviews and changedescs) Next steps: Figure out how LocalSites affect the action feed Implement AJAX calls for expanded boxes
Diff: |
Revision 2 (+262 -12) |
---|
-
A few more style issues.
-
-
-
-
-
reviewboard/templates/reviews/action_feed.html (Diff revision 2) Indent inside the '{%', not outside. i.e.: {% for {% if {% definevar ... {% endif {% endfor
-
reviewboard/templates/reviews/action_feed.html (Diff revision 2) One more level of indentation here.
-
-
-
-
-
Change Summary:
Added local sites logic Fixed some issues raised during past meetings Removed the expanding box functionality
Description: |
|
|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+305 -36) |
-
Quick review, mostly style.
-
reviewboard/reviews/views.py (Diff revision 5) Tiny optimization: _request = self.request Since self.request is being called three times within the method body. Less .'s means faster code.
-
-
reviewboard/settings.py (Diff revision 5) Wouldn't it be easier to do this calculation before hand and leave the reasoning in a comment? i.e.: = 31536000 # 365 * 24 * 60 * 60 (1 year)
-
-
reviewboard/templates/reviews/action_feed.html (Diff revision 5) Translate: Review request. Remove the trailing white space.
-
reviewboard/templates/reviews/action_feed.html (Diff revision 5) You can shift the the {% %} logic all the way to the left. That saves on white space being sent to the client.
-
-
-
Change Summary:
Minor change to the html
Diff: |
Revision 8 (+305 -36) |
||||||
---|---|---|---|---|---|---|---|
Added Files: |
|||||||
Screenshots: |
|
-
-
reviewboard/reviews/admin.py (Diff revision 7) We're probably not doing great about alphabetical order here, but might as well place this above the others.
-
reviewboard/reviews/models.py (Diff revision 7) Just for readability, put each parameter on its own line (and start with the Action.objects.create) line.
-
reviewboard/reviews/models.py (Diff revision 7) Same as above. Actually, given that we do this twice, can we just set a couple common variables and then create the action after this if/else?
-
-
reviewboard/reviews/models.py (Diff revision 7) Same here. Blank line after this. I prefer blank lines between blocks and other code (like around an if, for, etc.)
-
-
-
reviewboard/reviews/models.py (Diff revision 7) Generally, (and I know a lot of older code doesn't do this), docs should be in this format: """One-line summary. Multi-line content. """ Or in this case, just """One-line summary."""
-
-
reviewboard/reviews/models.py (Diff revision 7) Instead of this, do this above: @property def request_display_id(self): ...
-
reviewboard/reviews/views.py (Diff revision 7) Are we expecting that the action feed will now be the default view? I'd be a little concerned about that, as it changes everybody's workflow. Instead, I'd rather we keep the existing default, and then later we should add some easier way to select a default or quickly jump to the desired node from any page.
-
-
-
reviewboard/reviews/views.py (Diff revision 7) In general, we should use "pk" instead of "id" when referring to the primary key of the model. Same with the user above.
-
-
-
-
reviewboard/static/rb/css/action-feed.less (Diff revision 7) All indentation should be 2 lines instead of 4.
-
reviewboard/static/rb/css/action-feed.less (Diff revision 7) Another case of {. Same with others in this file.
-
-
-
-
Change Summary:
Added the Action resource and the javascript for expanding the action boxes for reviews and changedescs. Open issues: * Creating the links for reviewed items feels a bit wrong, but I was trying to minimize the number of queries and make do with the available info * The file attachment comment resource doesn't provide a link to the actual file, so I'm just displaying the title, for now * The boxes containing replies are still ToDo
Diff: |
Revision 11 (+835 -38) |
||||||
---|---|---|---|---|---|---|---|
Screenshots: |
|
-
-
-
reviewboard/reviews/datagrids.py (Diff revision 11) Let's go ahead and use 'action-feed'. '-' is nicer in URLs.
-
-
reviewboard/reviews/models.py (Diff revision 11) We should avoid queries on these objects. So instead, do: if self.review_id: return self.review_id elif self.changedesc_id: return self.changedesc_id This should return something when neither of the above conditionals match.
-
-
reviewboard/reviews/models.py (Diff revision 11) Should also check review_id and changedesc_id, and return some default.
-
-
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Indentation looks wrong. This map should only be defined once, outside the function.
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) You should only have one var statement, formatted like: var body = ..., request_url = ...;
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Best as: var changeitems = $('<ul/>') .appendTo(body);
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) This var needs to also be before. In JavaScript, all variables when compiling in the VM are moved to the top of the scope.
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Best to append changeitem after you've completely populated it, at the end of the loop.
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Best done as: field_name = field_name_map[field] || field
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Should be: changeitem.append($('<label/>').text(field_name)); This will do the right thing if there are characters in field_name that need escaping (such as when localized).
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) In general, instead of 'in', it's best to do field_changed.hasOwnProperty('added'). The reason being that if anything were to populate the base object with 'added' or whatever, this check could fail. By using hasOwnProperty, you ensure you're only looking up in field_changed. It also won't nest into the prototype, so it's a little quicker.
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Hmm, not sure what you're doing here? I don't know that an object for added/removed is correct.
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) In JavaScript, always use braces. Given that we do field_changed[type] a lot, I would just pull that value out once up-front and reuse it.
-
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Build this with jQuery's methods to ensure there aren't HTML encoding issues.
-
-
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) No blank lines. For the field_changed length check, you'll want to pull the length out into a variable first. Saves on a recompute every iteration.
-
-
-
-
-
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Alignment for multiline is wrong. Should use === for comparison. One set of var statements.
-
-
-
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Move var out of the for, since it's really going to be promoted to the top of the "else if" block anyway.
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Build with jQuery. Make sure to always use braces.
-
-
-
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Alignment is off. The whole function should build with jQuery.
-
-
-
-
-
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Move this into the declaration above, before my proposed appendTo.
-
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) vars go first. comment can probably just be defined in each loop that needs it.
-
reviewboard/static/rb/js/action-feed.js (Diff revision 11) Build with jQuery. These comments apply to everywhere else in the JavaScript.
-
-
reviewboard/webapi/resources.py (Diff revision 11) No blank line. The resource needs a description. This will be auto-generated for our API docs page. Make sure to follow the styles for other resources.
-
reviewboard/webapi/resources.py (Diff revision 11) I've noticed this a couple times now. Instead of repeating it, you should define a Manager class that the Action uses, which will define a function for this. So: class Action(...): ... objects = ActionManager() Then in managers.py: class ActionManager(...): def from_visits(self): # That query here
-
-
reviewboard/webapi/resources.py (Diff revision 11) You can do: if field in ('screenshot_captions, 'file_captions'):
Change Summary:
Added the action resource to the docs.
-
This looks fine with the exception being the one I noted about the Manager (I don't mind this being a separate cleanup change on top of this), and the unit test failures where Action.submitter doesn't allow null. That needs to be fixed before this goes in. I'll be committing all these changes when done onto an action-feed branch, which will later be merged into master.