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 13 and 14

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.
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`.
ebd7fcf3accd3c9d9661ffcecd88ccd287a5da47 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.
dc307f916fe70b3da9ad7a4dbcb303c781d1d595 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.
5dc5fee06536328e6bdbbcc172f823d27dccad01 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`.
7cbadcf1e02637f75507d76265ccf75f12e47c17 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.
5998c75acbd440e7221729ac31f86398dfcee0c4 Daniel
reviewboard/accounts/models.py
reviewboard/accounts/forms/pages.py
Loading...