Saving last nickname change within the server

This commit is contained in:
WolverinDEV 2019-06-19 11:08:46 +02:00
parent 1cf166eefb
commit e9bae1ee0c
3 changed files with 7 additions and 2 deletions

View file

@ -509,7 +509,7 @@ class ConnectionHandler {
console.log(tr("Allowed to auto reconnect. Reconnecting in 5000ms"));
const server_address = this.serverConnection.remote_address();
const profile = this.serverConnection.handshake_handler().profile;
const name = this.serverConnection.handshake_handler().name;
const name = this.getClient().clientNickName();
const password = this.serverConnection.handshake_handler().server_password;
this._reconnect_timer = setTimeout(() => {

View file

@ -901,6 +901,7 @@ class LocalClientEntry extends ClientEntry {
elm.text(_self.clientNickName());
_self.handle.serverConnection.command_helper.updateClient("client_nickname", text).then((e) => {
settings.changeGlobal(Settings.KEY_CONNECT_USERNAME, text);
this.channelTree.client.chat.serverChat().appendMessage(tr("Nickname successfully changed"));
}).catch((e: CommandResult) => {
this.channelTree.client.chat.serverChat().appendError(tr("Could not change nickname ({})"), e.extra_message);

View file

@ -28,7 +28,7 @@ namespace Modals {
let updateFields = function () {
console.log("Updating");
if(selected_profile)
input_nickname.attr("placeholder", selected_profile.default_username);
input_nickname.attr("placeholder", settings.static_global(Settings.KEY_CONNECT_USERNAME, selected_profile.default_username));
else
input_nickname.attr("placeholder", "");
@ -77,6 +77,10 @@ namespace Modals {
input_profile.on('change', event => {
selected_profile = profiles.find_profile(input_profile.val() as string);
{
settings.changeGlobal(Settings.KEY_CONNECT_USERNAME, selected_profile.default_username);
input_nickname.val(selected_profile.default_username);
}
input_profile.toggleClass("is-invalid", !selected_profile || !selected_profile.valid());
updateFields();
});