Use Set() for condensed types
This commit is contained in:
parent
f0b0c53536
commit
f3b383ce63
@ -83,7 +83,7 @@ export default {
|
|||||||
// If actions are hidden, just return a message list with them excluded
|
// If actions are hidden, just return a message list with them excluded
|
||||||
if (this.$store.state.settings.statusMessages === "hidden") {
|
if (this.$store.state.settings.statusMessages === "hidden") {
|
||||||
return this.channel.messages.filter(
|
return this.channel.messages.filter(
|
||||||
(message) => !constants.condensedTypes.includes(message.type)
|
(message) => !constants.condensedTypes.has(message.type)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ export default {
|
|||||||
if (
|
if (
|
||||||
message.self ||
|
message.self ||
|
||||||
message.highlight ||
|
message.highlight ||
|
||||||
!constants.condensedTypes.includes(message.type)
|
!constants.condensedTypes.has(message.type)
|
||||||
) {
|
) {
|
||||||
lastCondensedContainer = null;
|
lastCondensedContainer = null;
|
||||||
|
|
||||||
|
@ -19,8 +19,7 @@ const colorCodeMap = [
|
|||||||
["15", "Light Grey"],
|
["15", "Light Grey"],
|
||||||
];
|
];
|
||||||
|
|
||||||
const condensedTypes = ["chghost", "join", "part", "quit", "nick", "kick", "mode"];
|
const condensedTypes = new Set(["chghost", "join", "part", "quit", "nick", "kick", "mode"]);
|
||||||
const condensedTypesQuery = "." + condensedTypes.join(", .");
|
|
||||||
|
|
||||||
const timeFormats = {
|
const timeFormats = {
|
||||||
msgDefault: "HH:mm",
|
msgDefault: "HH:mm",
|
||||||
@ -33,7 +32,6 @@ export default {
|
|||||||
colorCodeMap,
|
colorCodeMap,
|
||||||
commands: [],
|
commands: [],
|
||||||
condensedTypes,
|
condensedTypes,
|
||||||
condensedTypesQuery,
|
|
||||||
timeFormats,
|
timeFormats,
|
||||||
sizeUnits,
|
sizeUnits,
|
||||||
// Same value as media query in CSS that forces sidebars to become overlays
|
// Same value as media query in CSS that forces sidebars to become overlays
|
||||||
|
@ -23,7 +23,7 @@ describe("client-side constants", function() {
|
|||||||
|
|
||||||
describe(".condensedTypes", function() {
|
describe(".condensedTypes", function() {
|
||||||
it("should be a non-empty array", function() {
|
it("should be a non-empty array", function() {
|
||||||
expect(constants.condensedTypes).to.be.an("array").that.is.not.empty;
|
expect(constants.condensedTypes).to.be.an.instanceof(Set).that.is.not.empty;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should only contain ASCII strings", function() {
|
it("should only contain ASCII strings", function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user