Disable front-end features for read-only mode

Review Request #8810 — Created March 11, 2017 and submitted — Latest diff uploaded

Review Board
8648, 8657
8861, 8824, 8847, 8812, 8811
reviewboard, students

Read-only mode is a setting an admin can enable to prevent writes to
the database. This can be used when the site is under maintenence or
being upgraded. This commit disables most UI features which would
normally affect Review Board, but under read-only mode, does not.
Disabling some features such as login and redirection when attempting
to view a read-only restricted page is contained in the next commit.

This commit contains changes to the datagrid so changes to it does not
change profile settings, navbar (hide My Account and New Review Request
buttons), ETag, ReviewRequestEditor(including actions, comments, and
the editor itself),

Other changes include adding read-only mode setting to the context
processor and adding a utility file containing the logic to determine
whether a user is in read-only mode or not.

  • Check that caching of read-only mode is done correctly by changing
    modes and refreshing pages
  • Check that profile doesn't save in datagrid when in read-only mode by
    ensuring code doesn't reach the save method
  • Check that the review request actions available are appropriately
    changed when in read-only mode
  • Check that comments can't be added or replied to in read-only mode
  • Check that review requests can not be modified in read-only mode
  • Check that modifying review requests (such as bugs or branch) when in
    read-only mode while the site in browser is still old displayed an
    appropriate error message
  • Check that modifying anything to the webapi doesn't send a request at
    all when in read-only mode
  • Check that trying to add a comment through clicking on a line in diff
    displays appropriate warning about read-only mode
  • Check that clicking on the Star does nothing in read-only mode
  • Check that the above does not occur for admins