reviewboard.reviews.actions¶
Actions for the reviews app.
- class CloseMenuAction[source]¶
Bases:
BaseMenuAction
A menu for closing the review request.
New in version 6.0.
- action_id: Optional[str] = 'close-menu'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'children': 'List[str]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class CloseCompletedAction[source]¶
Bases:
BaseAction
The action to close a review request as completed.
New in version 6.0.
- action_id: Optional[str] = 'close-completed'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'close-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_view_class: str = 'RB.CloseCompletedActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class CloseDiscardedAction[source]¶
Bases:
BaseAction
The action to close a review request as discarded.
New in version 6.0.
- action_id: Optional[str] = 'close-discarded'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'close-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_view_class: str = 'RB.CloseDiscardedActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class DeleteAction[source]¶
Bases:
BaseAction
The action to permanently delete a review request.
New in version 6.0.
- action_id: Optional[str] = 'delete-review-request'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'close-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_view_class: str = 'RB.DeleteActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class DownloadDiffAction[source]¶
Bases:
BaseAction
The action to download a diff.
New in version 6.0.
- action_id: Optional[str] = 'download-diff'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- get_url(*, context: Context) str [source]¶
Return this action’s URL.
- Parameters:
context (
django.template.Context
) – The collection of key-value pairs from the template.- Returns:
The URL to invoke if this action is clicked.
- Return type:
- get_visible(*, context: Context) bool [source]¶
Return whether the action should start visible or not.
- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should start visible.False
, otherwise.- Return type:
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class ReviewMenuAction[source]¶
Bases:
BaseMenuAction
The “Review” menu on the unified banner.
New in version 6.0.
- action_id: Optional[str] = 'review-menu'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- icon_class: Optional[str] = 'rb-icon rb-icon-compose-review'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_view_class: str = 'RB.ReviewMenuActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- should_render(context: Context) bool [source]¶
Return whether this action should render.
This menu only renders when the user is logged in and the unified banner feature is enabled.
- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'children': 'List[str]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class CreateReviewAction[source]¶
Bases:
BaseAction
Action to create a new, blank review.
New in version 6.0.
- action_id: Optional[str] = 'create-review'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'review-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- description = ['Your review will start off blank, but you can add text and general comments to it.', 'Adding comments to code or file attachments will automatically create a new review for you.'][source]¶
- icon_class: Optional[str] = 'rb-icon rb-icon-create-review'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_view_class: str = 'RB.CreateReviewActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- template_name: str = 'actions/detailed_menuitem_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class EditReviewAction[source]¶
Bases:
BaseAction
Action to edit an existing review.
New in version 6.0.
- action_id: Optional[str] = 'edit-review'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'review-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- icon_class: Optional[str] = 'rb-icon rb-icon-compose-review'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_view_class: str = 'RB.EditReviewActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- template_name: str = 'actions/detailed_menuitem_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class AddGeneralCommentAction[source]¶
Bases:
BaseAction
Action to add a general comment.
New in version 6.0.
- action_id: Optional[str] = 'add-general-comment'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'review-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- description = ['Add a new general comment about the change, not attached to any code or file attachments.'][source]¶
- icon_class: Optional[str] = 'rb-icon rb-icon-edit'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_view_class: str = 'RB.AddGeneralCommentActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- template_name: str = 'actions/detailed_menuitem_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class ShipItAction[source]¶
Bases:
BaseAction
Action to mark a review request as “Ship It”.
New in version 6.0.
- action_id: Optional[str] = 'ship-it'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'review-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- description = ["You're happy with what you're seeing, and would like to approve it.", 'If you want to leave a comment with this, choose "Create a new review" above.'][source]¶
- icon_class: Optional[str] = 'rb-icon rb-icon-shipit'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_view_class: str = 'RB.ShipItActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- template_name: str = 'actions/detailed_menuitem_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class LegacyAddGeneralCommentAction[source]¶
Bases:
BaseAction
The action for adding a general comment.
New in version 6.0.
- action_id: Optional[str] = 'legacy-add-general-comment'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class LegacyEditReviewAction[source]¶
Bases:
BaseAction
The old-style “Edit Review” action.
This exists within the review request actions area, and will be supplanted by the new action in the Review menu in the unified banner.
New in version 6.0.
- action_id: Optional[str] = 'legacy-edit-review'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class LegacyShipItAction[source]¶
Bases:
BaseAction
The old-style “Ship It” action.
This exists within the review request actions area, and will be supplanted by the new action in the Review menu in the unified banner.
New in version 6.0.
- action_id: Optional[str] = 'legacy-ship-it'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class UpdateMenuAction[source]¶
Bases:
BaseMenuAction
A menu for updating the review request.
New in version 6.0.
- action_id: Optional[str] = 'update-menu'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'children': 'List[str]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class UploadDiffAction[source]¶
Bases:
BaseAction
The action to update or upload a diff.
New in version 6.0.
- action_id: Optional[str] = 'upload-diff'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'update-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_view_class: str = 'RB.UpdateDiffActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- get_label(*, context: Context) _StrOrPromise [source]¶
Return the label for the action.
- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
The label to use for the action.
- Return type:
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class UploadFileAction[source]¶
Bases:
BaseAction
The action to upload a new file attachment.
New in version 6.0.
- action_id: Optional[str] = 'upload-file'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'update-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_view_class: str = 'RB.AddFileActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class StarAction[source]¶
Bases:
BaseAction
The action to star a review request.
New in version 6.0.
- action_id: Optional[str] = 'star-review-request'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- template_name: str = 'reviews/star_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class ArchiveMenuAction[source]¶
Bases:
BaseMenuAction
A menu for managing the visibility state of the review request.
New in version 6.0.
- action_id: Optional[str] = 'archive-menu'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- template_name: str = 'reviews/archive_menu_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- js_view_class: str = 'RB.ArchiveMenuActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool [source]¶
Return whether this action should render.
This differs from
hidden
in that hidden actions still render but are hidden by CSS, whereas if this returnsFalse
the action will not be included in the DOM at all.- Parameters:
context (
django.template.Context
) – The current rendering context.- Returns:
True
if the action should render.- Return type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'children': 'List[str]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class ArchiveAction[source]¶
Bases:
BaseAction
An action for archiving the review request.
New in version 6.0.
- action_id: Optional[str] = 'archive'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'archive-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- template_name: str = 'reviews/archive_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- js_view_class: str = 'RB.ArchiveActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class MuteAction[source]¶
Bases:
BaseAction
An action for muting the review request.
New in version 6.0.
- action_id: Optional[str] = 'mute'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- parent_id: Optional[str] = 'archive-menu'[source]¶
The ID of the parent menu action, if available.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- template_name: str = 'reviews/archive_action.html'[source]¶
The name of the template to use when rendering.
- Type:
- js_view_class: str = 'RB.MuteActionView'[source]¶
The class to instantiate for the JavaScript view.
- Type:
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class BaseReviewRequestAction[source]¶
Bases:
BaseAction
A base class for an action that can be applied to a review request.
Creating an action requires subclassing
BaseReviewRequestAction
and overriding any fields/methods as desired. Different instances of the same subclass can also override the class fields with their own instance fields.Example
class UsedOnceAction(BaseReviewRequestAction): action_id = 'once' label = 'This is used once.' class UsedMultipleAction(BaseReviewRequestAction): def __init__(self, action_id, label): super().__init__() self.action_id = 'repeat-' + action_id self.label = 'This is used multiple times,'
Note
Since the same action will be rendered for multiple different users in a multithreaded environment, the action state should not be modified after initialization. If we want different action attributes at runtime, then we can override one of the getter methods (such as
get_label()
), which by default will simply return the original attribute from initialization.Deprecated since version 6.0: New code should be written using
reviewboard.actions.base.BaseAction
. This class will be removed in 7.0.- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- __init__() None [source]¶
Initialize this action.
By default, actions are top-level and have no children.
- property max_depth: int[source]¶
Lazily compute the max depth of any action contained by this action.
Top-level actions have a depth of zero, and child actions have a depth that is one more than their parent action’s depth.
Algorithmically, the notion of max depth is equivalent to the notion of height in the context of trees (from graph theory). We decided to use this term instead so as not to confuse it with the dimensional height of a UI element.
- Returns:
The max depth of any action contained by this action.
- Return type:
- get_extra_context(*, request: HttpRequest, context: Context) dict [source]¶
Return extra template context for the action.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.context (
django.template.Context
) – The current rendering context.
- Returns:
Extra context to use when rendering the action’s template.
- Return type:
- copy_to_dict(context: Context) dict [source]¶
Copy this action instance to a dictionary.
This is a legacy implementation left to maintain compatibility with custom templates.
- register(parent: Optional[BaseReviewRequestMenuAction] = None) None [source]¶
Register this review request action instance.
Note
Newly registered top-level actions are appended to the left of the other previously registered top-level actions. So if we intend to register a collection of top-level actions in a certain order, then we likely want to iterate through the actions in reverse.
- Parameters:
parent (
BaseReviewRequestMenuAction
, optional) – The parent action instance of this action instance.- Raises:
KeyError – A second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- unregister() None [source]¶
Unregister this review request action instance.
Note
This method can mutate its parent’s child actions. So if we are iteratively unregistering a parent’s child actions, then we should consider first making a clone of the list of children.
- Raises:
KeyError – An unregistration is attempted before it’s registered.
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- class BaseReviewRequestMenuAction(child_actions: Optional[List[BaseReviewRequestAction]] = None)[source]¶
Bases:
BaseMenuAction
A base class for an action with a dropdown menu.
Deprecated since version 6.0: New code should be written using
reviewboard.actions.base.BaseMenuAction
. This class will be removed in 7.0.- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None
, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- __init__(child_actions: Optional[List[BaseReviewRequestAction]] = None) None [source]¶
Initialize this menu action.
- Parameters:
child_actions (
list
ofBaseReviewRequestAction
, optional) – The list of child actions to be contained by this menu action.- Raises:
KeyError – A second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- copy_to_dict(context: Context) dict [source]¶
Copy this menu action instance to a dictionary.
This is a legacy implementation left to maintain compatibility with custom templates.
- Parameters:
context (
django.template.Context
) – The collection of key-value pairs from the template.- Returns:
The corresponding dictionary.
- Return type:
- get_extra_context(*, request: HttpRequest, context: Context) dict [source]¶
Return extra template context for the action.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.context (
django.template.Context
) – The current rendering context.
- Returns:
Extra context to use when rendering the action’s template.
- Return type:
- property max_depth: int[source]¶
Lazily compute the max depth of any action contained by this action.
- Returns:
The max depth of any action contained by this action.
- Return type:
- register(parent: Optional[BaseReviewRequestMenuAction] = None) None [source]¶
Register this review request action instance.
Note
Newly registered top-level actions are appended to the left of the other previously registered top-level actions. So if we intend to register a collection of top-level actions in a certain order, then we likely want to iterate through the actions in reverse.
- Parameters:
parent (
BaseReviewRequestMenuAction
, optional) – The parent action instance of this action instance.- Raises:
KeyError – A second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- unregister() None [source]¶
Unregister this review request action instance.
This menu action recursively unregisters its child action instances.
- Raises:
KeyError – An unregistration is attempted before it’s registered.
- __annotations__ = {'action_id': 'Optional[str]', 'apply_to': 'Optional[List[str]]', 'attachment': 'str', 'child_actions': 'List[BaseAction]', 'children': 'List[str]', 'icon_class': 'Optional[str]', 'js_model_class': 'str', 'js_template_name': 'str', 'js_view_class': 'str', 'label': 'Optional[_StrOrPromise]', 'parent_action': 'Optional[BaseMenuAction]', 'parent_id': 'Optional[str]', 'template_name': 'str', 'url': 'str', 'url_name': 'Optional[str]', 'visible': 'bool'}¶
- register_actions(actions: List[Union[BaseReviewRequestAction, BaseReviewRequestMenuAction]], parent_id: Optional[str] = None) None [source]¶
Register the given actions as children of the corresponding parent.
If no parent_id is given, then the actions are assumed to be top-level.
Deprecated since version 6.0: Users should switch to
reviewboard.actions.actions_registry
. This method will be removed in Review Board 7.- Parameters:
actions (
iterable
ofBaseReviewRequestAction
) – The collection of action instances to be registered.parent_id (
unicode
, optional) – The action ID of the parent of each action instance to be registered.
- Raises:
KeyError – The parent action cannot be found or a second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- unregister_actions(action_ids: Iterable[str]) None [source]¶
Unregister each of the actions corresponding to the given IDs.
Deprecated since version 6.0: Users should switch to
reviewboard.actions.actions_registry
. This method will be removed in Review Board 7.
- clear_all_actions() None [source]¶
Clear all registered actions.
This method is really only intended to be used by unit tests. We might be able to remove this hack once we convert to djblets.registries.
Deprecated since version 6.0: Users should switch to
reviewboard.actions.actions_registry
. This method will be removed in Review Board 7.Warning
This will clear all actions, even if they were registered in separate extensions.