Port existing actions over to the new framework.
Review Request #12757 — Created Dec. 22, 2022 and submitted
The new actions framework has a lot more flexibility and consistency
than the old one. This change ports over our existing review request
actions and extension hooks to use it. In addition, several things which
worked like actions (like the star and archive/mute menu) but were
implemented outside of the framework have been rewritten to be actions
instead.This also reimplements the client-side styling and logic for menus and
the mobile menu, using the new CSS component style and building on
RB.MenuView for the drop-downs. This gives us more consistent style
rules as well as support for keyboard and screen-reader accessibility.
- Tested review request actions in several scenarios, including when
logged out and in mobile mode. - Ran unit tests.
Summary | ID |
---|---|
716400770d1d99a6bf79937527aa84c28ef5204b |
Description | From | Last Updated |
---|---|---|
Typo in the description: "conistency" -> "consistency" |
chipx86 | |
undefined name 'parent' Column: 52 Error code: F821 |
reviewbot | |
Expected '===' and instead saw '=='. Column: 46 Error code: W116 |
reviewbot | |
Is it possible for people to make their own attachment points? From the docs it's unclear whether this is possible … |
maubin | |
Should there be 2 spaces here? |
maubin | |
Should there be 2 spaces here? |
maubin | |
This could use some updating to mention how we can have non-UI actions and actions for the unified banner, maybe … |
maubin | |
This could all fit on one line I think. |
maubin | |
Add -> None: |
maubin | |
Update the description, action arg type and Raises section of this method to include how the given action can be … |
maubin | |
Missing a space between "reviewrequest". |
maubin | |
I wonder if it would be worthwhile to make some mixins or decorators for some of the repeated access control … |
maubin | |
Should we wrap reviewboard.actions.actions_registry in some Sphinx directive? Would :py:obj: work? |
maubin | |
Should we wrap reviewboard.actions.actions_registry in some Sphinx directive? Would :py:obj: work? |
maubin | |
Could sort this alphabetically. |
maubin | |
Maybe worth making all of these links/refs to the appropriate attributes/methods? |
chipx86 | |
Super small nit, but I feel like this may read better with the IDs grouped together |
chipx86 | |
Can we document this, with a Version Added? |
chipx86 | |
While not a problem, we shouldn't need to do this, as initialize is intentionally empty by default. |
chipx86 | |
Can we add a type/docs for this on the class body? |
chipx86 | |
Changing the IDs here (and below) might break existing extensions. |
chipx86 | |
What's the TODO? |
chipx86 | |
Alignment issue. |
chipx86 | |
This can probably use self.create_http_request(...) |
chipx86 | |
This seems unrelated. |
chipx86 | |
Everything in here but the perms and seems to return a bool result. Maybe we just want bool(...) for perms? |
chipx86 | |
Same comment about perms here. Also, can we add a blank line before return statements? |
chipx86 | |
Leftover debugging information. |
chipx86 | |
This isn't something we can reverse? |
chipx86 | |
This doesn't have to be this change, but we should track it: We could improve this through a ReviewRequest.has_diffsets() method … |
chipx86 | |
Same comment about perms. |
chipx86 | |
Super tiny nit for all these similar blocks. We have 3 lines that pull from context, and one line that … |
chipx86 | |
Same here about perms. |
chipx86 | |
Same comment about perms. |
chipx86 | |
For these, it'd be nice to group related attributes. action_id and parent_id should probably go together. attachment and apply_to feel … |
chipx86 | |
Since extensions will most likely be using some subclass of this, we should ideally use that name. Not sure what … |
chipx86 | |
Can you put this in alphabetical order? |
chipx86 | |
Can this be self.child_actions = child_actions or []? |
chipx86 | |
Can you put this in alphabetical order? |
chipx86 | |
Can we state in the docs here and below that we're removing this in 7? |
chipx86 | |
Missing a trailing period. |
chipx86 | |
Missing a trailing period. |
chipx86 | |
Missing a trailing period. |
chipx86 | |
djblets is mixed in with django. |
chipx86 | |
Older code, but I think this can be: self.assertIs( self.action.should_render(context=request_context), getattr(self, 'read_only_always_show', False)) Though, maybe less obvious? I don't know. |
chipx86 | |
Too much JS! deprecation_message :) But with my other comments about fixing warnings to be per-class, this will need to … |
chipx86 | |
These should be assertIsNone. Same with many below. |
chipx86 | |
This is hard to read. Can we go with keyword arguments here, like create_http_request does? (And same elsewhere.) I almost … |
chipx86 | |
Can we explicitly return a value if we don't return in the loop? Right now we just get an implicit … |
chipx86 | |
While here, can we alphabetize these? |
chipx86 | |
Can we add Version Added to each of these? |
chipx86 | |
Can you put parens around the comparison? Helps with readability, given the =. |
chipx86 | |
We should keep to public before private. Also, it'd be nice to have docs for the public attributes. |
chipx86 | |
Extra blank line here. |
chipx86 | |
Can we break this down into the multi-line format? Any time we have typing in params. Same with others. |
chipx86 | |
Can we document this as well? And same with other public attributes. |
chipx86 | |
I don't think we need export {} anymore. |
chipx86 | |
Can we alphabetize these? |
chipx86 | |
actions should go after accounts, alphabetically. |
chipx86 | |
Missing quotes around the {{action.get_dom_element_id}}. |
chipx86 | |
No space needed before style. |
chipx86 | |
Missing quotes around {{action.get_dom_element_id}}. |
chipx86 |
- Commits:
-
Summary ID be0d161d6c0fbeece2fc37503a56af8436644f12 7842247021f413d1ff996261df024f4736de5745 - Diff:
-
Revision 2 (+4540 -3148)
Checks run (2 succeeded)
- Change Summary:
-
Update for change in class names.
- Commits:
-
Summary ID 7842247021f413d1ff996261df024f4736de5745 f00b8a0397da09c73e0837d94237c515bb370c91 - Diff:
-
Revision 3 (+4540 -3148)
Checks run (2 succeeded)
-
-
Is it possible for people to make their own attachment points? From the docs it's unclear whether this is possible and how to do this, maybe we could elaborate on this.
-
-
-
This could use some updating to mention how we can have non-UI actions and actions for the unified banner, maybe you could link to the AttachmentPoint class too.
-
-
-
Update the description,
action
arg type andRaises
section of this method to include how the given action can be aBaseReviewRequestMenuAction
. -
-
I wonder if it would be worthwhile to make some mixins or decorators for some of the repeated access control logic we have in the
should_render
methods for these actions. -
-
-
- Commits:
-
Summary ID f00b8a0397da09c73e0837d94237c515bb370c91 8a29f2e65fc118df3d23011a24e33f2dc1cff20f - Diff:
-
Revision 4 (+4560 -3136)
Checks run (2 succeeded)
- Change Summary:
-
- Port JS to spina.
- Move registry population for defaults into this commit.
- Commits:
-
Summary ID 8a29f2e65fc118df3d23011a24e33f2dc1cff20f c2453b2aa358658d794fb6a856f5d9bd03e3572b - Diff:
-
Revision 5 (+4520 -3136)
Checks run (2 succeeded)
- Change Summary:
-
- Update for API changes in base actions commit.
- Move some parts from /r/12775 into this change.
- Misc. cleanup.
- Commits:
-
Summary ID c2453b2aa358658d794fb6a856f5d9bd03e3572b d0d7ac3d5fbd156ae678749e9c8b1e76c7dd5235 - Diff:
-
Revision 6 (+4870 -3206)
Checks run (2 succeeded)
-
-
-
-
-
-
-
-
-
-
-
-
-
Everything in here but the
perms and
seems to return abool
result. Maybe we just wantbool(...)
forperms
? -
-
-
This doesn't have to be this change, but we should track it:
We could improve this through a
ReviewRequest.has_diffsets()
method that checks:- Is
self._diffsets
set (viaget_diffsets()
). If so, use that. - Is
diffset_history
loaded from the database? If so, use thatdiffsets
relation. - Else, do
DiffSet.objects.filter(history=self.diffset_history_id).exists()
- Is
-
-
Super tiny nit for all these similar blocks. We have 3 lines that pull from
context
, and one line that doesn't, smack in the middle. It'd be nice to separate that one out. -
-
-
For these, it'd be nice to group related attributes.
action_id
andparent_id
should probably go together.attachment
andapply_to
feel related. -
Since extensions will most likely be using some subclass of this, we should ideally use that name.
Not sure what the best approach is to get that name, since
type(self).__name__
will return the subclass.But we probably should list that anyway in the error message, so there's a warning per-usage, instead of only one per-process (since warnings with the same text don't repeat).
-
-
-
-
-
-
-
-
-
Older code, but I think this can be:
self.assertIs( self.action.should_render(context=request_context), getattr(self, 'read_only_always_show', False))
Though, maybe less obvious? I don't know.
-
Too much JS!
deprecation_message
:)But with my other comments about fixing warnings to be per-class, this will need to go away and move into the tests.
-
-
This is hard to read. Can we go with keyword arguments here, like
create_http_request
does? (And same elsewhere.)I almost wonder if we should ditch
self.request
and just have tests provide what they want increate_http_request
, so it's all self-contained. But probably not worth it for this change. -
Can we explicitly return a value if we don't return in the loop?
Right now we just get an implicit
undefined
. -
-
-
-
-
Can we break this down into the multi-line format? Any time we have typing in params.
Same with others.
-
-
-
-
-
-
- Change Summary:
-
- Made requested changes
- Move extension-related parts into /r/12775
- Summary:
-
Port existing actions and extension hooks over to the new framework.Port existing actions over to the new framework.
- Description:
-
~ The new actions framework has a lot more flexibility and conistency than
~ the old one. This change ports over our existing review request actions ~ and extension hooks to use it. In addition, several things which worked ~ like actions (like the star and archive/mute menu) but were implemented ~ outside of the framework have been rewritten to be actions instead. ~ The new actions framework has a lot more flexibility and consistency
~ than the old one. This change ports over our existing review request ~ actions and extension hooks to use it. In addition, several things which ~ worked like actions (like the star and archive/mute menu) but were ~ implemented outside of the framework have been rewritten to be actions + instead. This also reimplements the client-side styling and logic for menus and
the mobile menu, using the new CSS component style and building on RB.MenuView for the drop-downs. This gives us more consistent style rules as well as support for keyboard and screen-reader accessibility. - Commits:
-
Summary ID d0d7ac3d5fbd156ae678749e9c8b1e76c7dd5235 c3cfad57726f6238e2494249a48ef81095e9deda - Diff:
-
Revision 7 (+3896 -3042)
Checks run (2 succeeded)
-
The change looks great.
I have a couple comments about documentation. I want to try to get our public docs a bit more fleshed out so it's easier to later track deprecations and usage and typing as we go forward.
-
-
-
- Commits:
-
Summary ID c3cfad57726f6238e2494249a48ef81095e9deda 716400770d1d99a6bf79937527aa84c28ef5204b - Diff:
-
Revision 8 (+3912 -3042)