Only allow username editing if username is unset
Once set, the username cannot be changed or deleted. If attempted this
fails with “405 Method Not Allowed”.
Change-Id: I15711ce9c6b350becd2a10fccc9655234e88bc8a
diff --git a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html
index e46be5b..d27d153 100644
--- a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html
+++ b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html
@@ -123,6 +123,8 @@
test('username render (mutable)', () => {
element.set('_serverConfig',
{auth: {editable_account_fields: ['USER_NAME']}});
+ element.set('_account.username', '');
+ element.set('_username', '');
const section = element.$.usernameSection;
const displaySpan = section.querySelectorAll('.value')[0];
@@ -179,10 +181,11 @@
});
test('username', done => {
+ element.set('_account.username', '');
+ element._hasUsernameChange = false;
assert.isTrue(element.usernameMutable);
- assert.isFalse(element.hasUnsavedChanges);
- element.set('_account.username', 'new username');
+ element.set('_username', 'new username');
assert.isTrue(usernameChangedSpy.called);
assert.isFalse(statusChangedSpy.called);