Merge pull request #3600 from thelounge/xpaw/condensed-set

Use Set() for condensed types
This commit is contained in:
Pavel Djundik 2019-12-17 15:43:50 +02:00 committed by GitHub
commit f1d806a80f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View file

@ -83,7 +83,7 @@ export default {
// If actions are hidden, just return a message list with them excluded
if (this.$store.state.settings.statusMessages === "hidden") {
return this.channel.messages.filter(
(message) => !constants.condensedTypes.includes(message.type)
(message) => !constants.condensedTypes.has(message.type)
);
}
@ -101,7 +101,7 @@ export default {
if (
message.self ||
message.highlight ||
!constants.condensedTypes.includes(message.type)
!constants.condensedTypes.has(message.type)
) {
lastCondensedContainer = null;

View file

@ -19,8 +19,7 @@ const colorCodeMap = [
["15", "Light Grey"],
];
const condensedTypes = ["chghost", "join", "part", "quit", "nick", "kick", "mode"];
const condensedTypesQuery = "." + condensedTypes.join(", .");
const condensedTypes = new Set(["chghost", "join", "part", "quit", "nick", "kick", "mode"]);
const timeFormats = {
msgDefault: "HH:mm",
@ -33,7 +32,6 @@ export default {
colorCodeMap,
commands: [],
condensedTypes,
condensedTypesQuery,
timeFormats,
sizeUnits,
// Same value as media query in CSS that forces sidebars to become overlays

View file

@ -23,7 +23,7 @@ describe("client-side constants", function() {
describe(".condensedTypes", 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() {