diff --git a/client/components/Channel.vue b/client/components/Channel.vue
index e38bdb7f..d31a5b2b 100644
--- a/client/components/Channel.vue
+++ b/client/components/Channel.vue
@@ -15,13 +15,27 @@
>
-
-
+
+
-
-
+
+
diff --git a/client/components/ChannelWrapper.vue b/client/components/ChannelWrapper.vue
index 572881bc..15339cc8 100644
--- a/client/components/ChannelWrapper.vue
+++ b/client/components/ChannelWrapper.vue
@@ -57,6 +57,10 @@ export default {
const extra = [];
const type = this.channel.type;
+ if (this.channel.favorite) {
+ `favorited on ${this.network.name}`;
+ }
+
if (this.channel.unread > 0) {
if (this.channel.unread > 1) {
extra.push(`${this.channel.unread} unread messages`);
diff --git a/client/components/Chat.vue b/client/components/Chat.vue
index 9838d1b6..c1257a4f 100644
--- a/client/components/Chat.vue
+++ b/client/components/Chat.vue
@@ -13,13 +13,13 @@
:id="'chan-' + channel.id"
class="chat-view"
:data-type="channel.type"
- :aria-label="channel.name"
+ :aria-label="channel.displayName ? channel.displayName : channel.name"
role="tabpanel"
>
-
-
-
+
+
+
+
+
-
diff --git a/client/components/NetworkList.vue b/client/components/NetworkList.vue
index 1c915e48..e78ed828 100644
--- a/client/components/NetworkList.vue
+++ b/client/components/NetworkList.vue
@@ -80,7 +80,12 @@
role="region"
aria-live="polite"
>
-
+
{
channel.favorite = false;
channel.displayName = "";
@@ -159,7 +158,7 @@ const store = new Vuex.Store({
);
netChan.channel.displayName =
- netChan.channel.name + `(${netChan.network.name})`;
+ netChan.channel.name + ` (${netChan.network.name})`;
otherNetChan.channel.displayName =
otherNetChan.channel.name + ` (${otherNetChan.network.name})`;
diff --git a/client/js/vue.js b/client/js/vue.js
index f03b2be4..d3a77191 100644
--- a/client/js/vue.js
+++ b/client/js/vue.js
@@ -50,16 +50,16 @@ new Vue({
});
}
);
+ } else if (channel.favorite) {
+ socket.emit("favorites:remove", Number(channel.id));
+ } else {
+ channel.closed = true;
- return;
+ socket.emit("input", {
+ target: Number(channel.id),
+ text: "/close",
+ });
}
-
- channel.closed = true;
-
- socket.emit("input", {
- target: Number(channel.id),
- text: "/close",
- });
},
},
render(createElement) {
diff --git a/src/client.js b/src/client.js
index f80048d8..03872c69 100644
--- a/src/client.js
+++ b/src/client.js
@@ -120,18 +120,7 @@ function Client(manager, name, config = {}) {
}
});
- (client.config.networks || []).forEach((network) => {
- client.connect(network, true);
-
- for (const chan of network.channels) {
- if (chan.favorite) {
- // third argument is whether to save or not;
- // we don't need to here as the config is loaded from the filesystem
- console.log(network.uuid, chan.id);
- client.addToFavorites(network.uuid, chan.id);
- }
- }
- });
+ (client.config.networks || []).forEach((network) => client.connect(network, true));
// Networks are stored directly in the client object
// We don't need to keep it in the config object
@@ -215,6 +204,7 @@ Client.prototype.connect = function (args, isStartup = false) {
key: chan.key || "",
type: chan.type,
muted: chan.muted,
+ favorite: chan.favorite,
})
);
});
@@ -308,6 +298,15 @@ Client.prototype.connect = function (args, isStartup = false) {
client.save();
channels.forEach((channel) => channel.loadMessages(client, network));
}
+
+ channels.forEach((chan) => {
+ if (chan.favorite) {
+ // The third argument for addToFavorites is whether to save,
+ // we will only be adding in this case if the favorite is loaded from disk,
+ // so we can safely set it to false.
+ this.addToFavorites(network.uuid, chan.id, false);
+ }
+ });
};
Client.prototype.generateToken = function (callback) {
@@ -666,7 +665,7 @@ Client.prototype.part = function (network, chan) {
const client = this;
network.channels = _.without(network.channels, chan);
client.mentions = client.mentions.filter((msg) => !(msg.chanId === chan.id));
- client.favoriteChannels = client.favoriteChannels.filter((fav) => fav.id !== chan.id);
+ client.favoriteChannels = client.favoriteChannels.filter((fav) => fav.channelId !== chan.id);
chan.destroy();
client.save();
client.emit("part", {