Merge pull request #3549 from thelounge/xpaw/client-setting-awayMessage
Make client awayMessage a client setting
This commit is contained in:
commit
c260e1a82f
@ -109,6 +109,21 @@
|
||||
Show seconds in timestamp
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="$store.state.settings.advanced" class="col-sm-12">
|
||||
<h2>Automatic away message</h2>
|
||||
|
||||
<label class="opt">
|
||||
<label for="awayMessage" class="sr-only">Automatic away message</label>
|
||||
<input
|
||||
id="awayMessage"
|
||||
:value="$store.state.settings.awayMessage"
|
||||
type="text"
|
||||
name="awayMessage"
|
||||
class="input"
|
||||
placeholder="Away message if The Lounge is not open"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<h2>
|
||||
Status messages
|
||||
|
@ -44,6 +44,10 @@ export const config = normalizeConfig({
|
||||
default: "",
|
||||
sync: "always",
|
||||
},
|
||||
awayMessage: {
|
||||
default: "",
|
||||
sync: "always",
|
||||
},
|
||||
links: {
|
||||
default: true,
|
||||
},
|
||||
|
@ -45,7 +45,7 @@ const events = [
|
||||
|
||||
function Client(manager, name, config = {}) {
|
||||
_.merge(this, {
|
||||
awayMessage: config.awayMessage || "",
|
||||
awayMessage: "",
|
||||
lastActiveChannel: -1,
|
||||
attachedClients: {},
|
||||
config: config,
|
||||
@ -94,6 +94,16 @@ function Client(manager, name, config = {}) {
|
||||
client.config.browser = {};
|
||||
}
|
||||
|
||||
// TODO: Backwards compatibility with older versions, remove in a future release?
|
||||
if (client.config.awayMessage) {
|
||||
client.config.clientSettings.awayMessage = client.config.awayMessage;
|
||||
delete client.config.awayMessage;
|
||||
}
|
||||
|
||||
if (client.config.clientSettings.awayMessage) {
|
||||
client.awayMessage = client.config.clientSettings.awayMessage;
|
||||
}
|
||||
|
||||
client.compileCustomHighlights();
|
||||
|
||||
_.forOwn(client.config.sessions, (session) => {
|
||||
|
@ -134,7 +134,6 @@ ClientManager.prototype.addUser = function(name, password, enableLog) {
|
||||
const user = {
|
||||
password: password || "",
|
||||
log: enableLog,
|
||||
awayMessage: "",
|
||||
networks: [],
|
||||
sessions: {},
|
||||
clientSettings: {},
|
||||
|
@ -593,6 +593,12 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
|
||||
|
||||
if (newSetting.name === "highlights") {
|
||||
client.compileCustomHighlights();
|
||||
} else if (newSetting.name === "awayMessage") {
|
||||
if (typeof newSetting.value !== "string") {
|
||||
newSetting.value = "";
|
||||
}
|
||||
|
||||
client.awayMessage = newSetting.value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user