Collapse prefetch errors by default

This commit is contained in:
Pavel Djundik 2019-12-23 12:15:23 +02:00
parent 8696f03e8d
commit 769585e72d
3 changed files with 7 additions and 1 deletions

View file

@ -235,10 +235,11 @@ export default {
switch (this.link.type) {
case "error":
// Collapse all errors by default unless its a message about image being too big
defaultState =
this.link.error === "image-too-big"
? this.$store.state.settings.media
: this.$store.state.settings.links;
: false;
break;
case "loading":

View file

@ -58,6 +58,7 @@ module.exports = function(client, chan, msg) {
parse(msg, chan, preview, res, client);
})
.catch((err) => {
preview.shown = false;
preview.type = "error";
preview.error = "message";
preview.message = err.message;

View file

@ -569,6 +569,8 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
this.irc.once("msg:preview", function(data) {
expect(data.preview.link).to.equal("http://localhost:" + port + "");
expect(data.preview.type).to.equal("error");
expect(data.preview.shown).to.equal(false);
done();
});
});
@ -602,6 +604,8 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
this.irc.once("msg:preview", function(data) {
expect(data.preview.link).to.equal("http://localhost:" + port + "");
expect(data.preview.type).to.equal("error");
expect(data.preview.shown).to.equal(false);
done();
});
});