Add siteconfig var and button for read-only mode
Review Request #8648 — Created Jan. 20, 2017 and submitted
Read-only mode is a new feature that allows users to view Review
Board while the site is being maintained or upgraded.
Added a toggle for read-only mode in Admin -> General Settings by
adding a checkbox.
Added a new attribute to siteconfig called site_read_only.
Toggling read-only mode will toggle the attribute to true/false.
In admin panel set new toggle to on/off and check that site_read_only
in siteconfig is set to true or false depending on whether the toggle
is checked or not.
Description | From | Last Updated |
---|---|---|
The description should tell a story about what this feature is for. See https://www.notion.so/reviewboard/Writing-Good-Change-Descriptions-10529e7c207743fa8ca90153d4b21fea. Basically, if I had no idea … |
chipx86 | |
The read-only feature should live in reviewboard.admin.features. This isn't specific to review requests. |
chipx86 | |
We prefer single quotes for strings wherever possible. |
chipx86 | |
This requires us to maintain two lists, which will easily lead to problems down the road. It also means that … |
chipx86 | |
As above, we don't need to map this to a setting. |
chipx86 | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Comments should have a trailing period. |
chipx86 | |
If this setting is being managed by siteconfig, we don't actually need a value in settings.py. We put things here … |
chipx86 | |
'django_reset' imported but unused |
reviewbot | |
'from settings_local import *' used; unable to detect undefined names |
reviewbot | |
non-superusers |
brennie | |
Col: 13 E128 continuation line under-indented for visual indent |
reviewbot |
-
-
The description should tell a story about what this feature is for. See https://www.notion.so/reviewboard/Writing-Good-Change-Descriptions-10529e7c207743fa8ca90153d4b21fea.
Basically, if I had no idea what read-only mode was already, I wouldn't learn anything from the description. Write the description so that if your friend saw it, they'd know what you're working on.
-
The read-only feature should live in
reviewboard.admin.features
. This isn't specific to review requests. -
-
This requires us to maintain two lists, which will easily lead to problems down the road. It also means that if the feature is dynamically enabled/disabled at runtime, the lists will be stale for any existing Apache threads.
There's a way around that, but I want to discuss where Features really come in.
A Feature is something we use to hide functionality from end users, unless the server has opted into it. The Read Only support is a global setting, and one we probably wouldn't ship until it's ready. I don't know that we need to hide it behind a Feature. (David and Barret might disagree -- if so, let's meet and discuss this.)
If we do keep it, what we'd want to do is instead do this check in the form's
__init__
, dynamically removing the field from the instance if the feature is disabled. -
-
-
If this setting is being managed by siteconfig, we don't actually need a value in
settings.py
. We put things here for modules that expect to read fromsettings
, but anything reading/writing from/to siteconfig can just make use of siteconfig.
- Change Summary:
-
Made changes according to last review.
- Summary:
-
Add Feature, siteconfig var, and button for read-only modeAdd siteconfig var and button for read-only mode
- Description:
-
~ Added reviews.read_only feature to enable the ability to toggle
~ read-only mode in Admin -> General Settings by adding a checkbox. ~ Added a new attribute to site configuration called site_read_only. ~ Read-only mode is a new feature that allows users to view Review
~ Board while the site is being maintained or upgraded. ~ Added a toggle for read-only mode in Admin -> General Settings by + adding a checkbox. + Added a new attribute to siteconfig called site_read_only. Toggling read-only mode will toggle the attribute to true/false. - Testing Done:
-
~ In admin panel set 'reviews.read_only' to true in the "enabled_features"
~ hash in site configurations and check that the new toggle is visible. ~ Then check that site_read_only in site configuration is set to true ~ In admin panel set new toggle to on/off and check that site_read_only
~ in siteconfig is set to true or false depending on whether the toggle ~ is checked or not. - or false depending on whether the toggle is checked or not. - Set 'reviews.read_only' to false in "enabled_features" and check that - the toggle is not visible. - Commit:
-
e2170d380db093131860026d8293432639330d157ffda32ddddca1e7676340b63007062fee960462
-
Tool: Pyflakes Processed Files: reviewboard/admin/siteconfig.py reviewboard/admin/forms.py Tool: PEP8 Style Checker Processed Files: reviewboard/admin/siteconfig.py reviewboard/admin/forms.py