make lint

This commit is contained in:
Loren Burkholder 2023-03-01 18:04:36 -05:00
parent 9616ee51b3
commit 2dc7492456

View file

@ -254,46 +254,47 @@ InputBar::updateTextContentProperties(const QString &t)
// check for invalid commands // check for invalid commands
auto commandName = getCommandAndArgs().first; auto commandName = getCommandAndArgs().first;
static const QSet<QString> validCommands{QStringLiteral("me"), static const QSet<QString> validCommands{QStringLiteral("me"),
QStringLiteral("react"), QStringLiteral("react"),
QStringLiteral("join"), QStringLiteral("join"),
QStringLiteral("knock"), QStringLiteral("knock"),
QStringLiteral("part"), QStringLiteral("part"),
QStringLiteral("leave"), QStringLiteral("leave"),
QStringLiteral("invite"), QStringLiteral("invite"),
QStringLiteral("kick"), QStringLiteral("kick"),
QStringLiteral("ban"), QStringLiteral("ban"),
QStringLiteral("unban"), QStringLiteral("unban"),
QStringLiteral("redact"), QStringLiteral("redact"),
QStringLiteral("roomnick"), QStringLiteral("roomnick"),
QStringLiteral("shrug"), QStringLiteral("shrug"),
QStringLiteral("fliptable"), QStringLiteral("fliptable"),
QStringLiteral("unfliptable"), QStringLiteral("unfliptable"),
QStringLiteral("sovietflip"), QStringLiteral("sovietflip"),
QStringLiteral("clear-timeline"), QStringLiteral("clear-timeline"),
QStringLiteral("reset-state"), QStringLiteral("reset-state"),
QStringLiteral("rotate-megolm-session"), QStringLiteral("rotate-megolm-session"),
QStringLiteral("md"), QStringLiteral("md"),
QStringLiteral("cmark"), QStringLiteral("cmark"),
QStringLiteral("plain"), QStringLiteral("plain"),
QStringLiteral("rainbow"), QStringLiteral("rainbow"),
QStringLiteral("rainbowme"), QStringLiteral("rainbowme"),
QStringLiteral("notice"), QStringLiteral("notice"),
QStringLiteral("rainbownotice"), QStringLiteral("rainbownotice"),
QStringLiteral("confetti"), QStringLiteral("confetti"),
QStringLiteral("rainbowconfetti"), QStringLiteral("rainbowconfetti"),
QStringLiteral("goto"), QStringLiteral("goto"),
QStringLiteral("converttodm"), QStringLiteral("converttodm"),
QStringLiteral("converttoroom")}; QStringLiteral("converttoroom")};
bool hasInvalidCommand = !commandName.isNull() && '/' + commandName != text() && !validCommands.contains(commandName); bool hasInvalidCommand =
!commandName.isNull() && '/' + commandName != text() && !validCommands.contains(commandName);
bool signalsChanged{false}; bool signalsChanged{false};
if (containsInvalidCommand_ != hasInvalidCommand) { if (containsInvalidCommand_ != hasInvalidCommand) {
containsInvalidCommand_ = hasInvalidCommand; containsInvalidCommand_ = hasInvalidCommand;
signalsChanged = true; signalsChanged = true;
} }
if (currentCommand_ != commandName) { if (currentCommand_ != commandName) {
currentCommand_ = commandName; currentCommand_ = commandName;
signalsChanged = true; signalsChanged = true;
} }
if (signalsChanged) { if (signalsChanged) {
emit currentCommandChanged(); emit currentCommandChanged();
@ -393,9 +394,8 @@ InputBar::send()
if (auto [commandName, args] = getCommandAndArgs(); commandName.isEmpty()) if (auto [commandName, args] = getCommandAndArgs(); commandName.isEmpty())
message(text()); message(text());
else else if (!command(commandName, args))
if (!command(commandName, args)) message(text());
message(text());
if (!wasEdit) { if (!wasEdit) {
history_.push_front(QLatin1String("")); history_.push_front(QLatin1String(""));