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.

Diff Revision 10

This is not the most recent revision of the diff. The latest diff is revision 14. See what's changed.

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

Commits

First Last 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
reviewboard/accounts/models.py
reviewboard/accounts/forms/pages.py
reviewboard/accounts/templatetags/accounts.py
reviewboard/accounts/tests/test_account_settings_form.py
reviewboard/accounts/tests/test_template_tags.py
Loading...