Added backend work for the archive profile setting

Review Request #14003 — Created June 28, 2024 and updated — Latest diff uploaded

Information

Review Board
master

Reviewers

Began backend implementation for a profile setting that will determine whether
to automatically archive a review request when posted.
This included adding a publish_and_archive BooleanField to the
AccountSettingsForm in reviewboard/accounts/pages.py, which is initially set
to False. publish_and_archive was also added to the Profile in
reviewboard/accounts/models.py. Lastly, publish_and_archive was also added to
reviewboard/accounts/accounts.py in the js_user_session_info() function.

A series of tests were also implmeneted to ensure that the AccountSettingsForm
was initialized, loaded, and saved properly and that it correctly identified
invalid inputs. These tests were added to
reviewboard/accounts/test/test_account_settings_form.py.

All previous passing pytests still passed.

Changes between revision 11 and 12

orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Commits

Summary ID Author
Backend for a user setting for Archive Review Request behavior when publishing.
This change introduce a new user setting called `publish_and_archive`, which is add to each user account and model. It also adds a new `BooleanField` option to the profile settings page to enable this feature.
db8bd3a166e7448670ead6ae85b8ae4ef818bd9e Daniel
Replace `publish_and_archive` `BooleanField` to not alter database.
Any additional `BooleanFields` in `models.py` automatically add that field to the database, which we want to avoid. Instead, a new `@property`, similar to `ui_theme_id`, is now used to handle `publish_and_archive`.
c837977102290bf537bb6248a929f56089c80255 Daniel
Updated AccountSettingsForm unit tests to account for `publish_and_archive`.
Introduced a new suite of unit tests for each feature added to the model. These serve to check that they are initialized, saved, and loaded properly. Tests to check for invalid or missing data were also included. Currently, `timezone` is the only required feature that can also be invalid.
4da6734f76f49b40be1e749e4e3b471dc889251e Daniel
Updated the typing for all the functions in models.
Typing was added to all of the functions in models.py for function parameters and return types.
ce575d65bc4677836cb219a703b3fc3a995bfec3 Daniel
Backend for a user setting for Archive Review Request behavior when publishing.
This change introduce a new user setting called `publish_and_archive`, which is add to each user account and model. It also adds a new `BooleanField` option to the profile settings page to enable this feature.
045daa0a7492b92fc41c1109d1ee3fa7f7bd9ede Daniel
Replace `publish_and_archive` `BooleanField` to not alter database.
Any additional `BooleanFields` in `models.py` automatically add that field to the database, which we want to avoid. Instead, a new `@property`, similar to `ui_theme_id`, is now used to handle `publish_and_archive`.
f035550bae4b5959007d349e7374ec0e8f820684 Daniel
Updated AccountSettingsForm unit tests to account for `publish_and_archive`.
Introduced a new suite of unit tests for each feature added to the model. These serve to check that they are initialized, saved, and loaded properly. Tests to check for invalid or missing data were also included. Currently, `timezone` is the only required feature that can also be invalid.
f3bd08332868680685757d4f8a2ddcf29fc3e8ff Daniel
Updated the typing for all the functions in models.
Typing was added to all of the functions in models.py for function parameters and return types.
78d6b279fa2e4a9528710ee10e6744576bce0eef Daniel
This diff has been split across 5 pages: 1 2 3 4 5 >
reviewboard/staticbundles.py
reviewboard/accounts/managers.py
reviewboard/accounts/models.py
reviewboard/accounts/views.py
reviewboard/diffviewer/commit_utils.py
reviewboard/diffviewer/diffutils.py
reviewboard/diffviewer/filediff_creator.py
reviewboard/diffviewer/parser.py
reviewboard/diffviewer/views.py
reviewboard/diffviewer/tests/test_commit_utils.py
reviewboard/diffviewer/tests/test_diffutils.py
reviewboard/diffviewer/tests/test_filediff_creator.py
reviewboard/diffviewer/tests/test_forms.py
reviewboard/reviews/context.py
reviewboard/reviews/detail.py
reviewboard/reviews/managers.py
reviewboard/reviews/models/review_request.py
reviewboard/reviews/models/review_request_draft.py
reviewboard/reviews/templatetags/reviewtags.py
reviewboard/reviews/tests/test_file_attachment_review_ui.py
This diff has been split across 5 pages: 1 2 3 4 5 >
Loading...