Remove "Online Logs" functionality (#1649)
The /logs command will direct users to the /user command instead Changelog has been updated to reflect this change
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Unversioned
|
## Unversioned
|
||||||
- Minor: Emotes in the emote popup are now sorted in the same order as the tab completion (#1549)
|
- Minor: Emotes in the emote popup are now sorted in the same order as the tab completion (#1549)
|
||||||
|
- Minor: Removed "Online Logs" functionality as services are shut down (#1640)
|
||||||
- Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546)
|
- Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546)
|
||||||
- Bugfix: FFZ custom mod badges no longer scale with the emote scale options (#1602)
|
- Bugfix: FFZ custom mod badges no longer scale with the emote scale options (#1602)
|
||||||
- Settings open faster
|
- Settings open faster
|
||||||
|
|||||||
@@ -229,7 +229,6 @@ SOURCES += \
|
|||||||
src/widgets/dialogs/IrcConnectionEditor.cpp \
|
src/widgets/dialogs/IrcConnectionEditor.cpp \
|
||||||
src/widgets/dialogs/LastRunCrashDialog.cpp \
|
src/widgets/dialogs/LastRunCrashDialog.cpp \
|
||||||
src/widgets/dialogs/LoginDialog.cpp \
|
src/widgets/dialogs/LoginDialog.cpp \
|
||||||
src/widgets/dialogs/LogsPopup.cpp \
|
|
||||||
src/widgets/dialogs/NotificationPopup.cpp \
|
src/widgets/dialogs/NotificationPopup.cpp \
|
||||||
src/widgets/dialogs/QualityPopup.cpp \
|
src/widgets/dialogs/QualityPopup.cpp \
|
||||||
src/widgets/dialogs/SelectChannelDialog.cpp \
|
src/widgets/dialogs/SelectChannelDialog.cpp \
|
||||||
@@ -451,7 +450,6 @@ HEADERS += \
|
|||||||
src/widgets/dialogs/IrcConnectionEditor.hpp \
|
src/widgets/dialogs/IrcConnectionEditor.hpp \
|
||||||
src/widgets/dialogs/LastRunCrashDialog.hpp \
|
src/widgets/dialogs/LastRunCrashDialog.hpp \
|
||||||
src/widgets/dialogs/LoginDialog.hpp \
|
src/widgets/dialogs/LoginDialog.hpp \
|
||||||
src/widgets/dialogs/LogsPopup.hpp \
|
|
||||||
src/widgets/dialogs/NotificationPopup.hpp \
|
src/widgets/dialogs/NotificationPopup.hpp \
|
||||||
src/widgets/dialogs/QualityPopup.hpp \
|
src/widgets/dialogs/QualityPopup.hpp \
|
||||||
src/widgets/dialogs/SelectChannelDialog.hpp \
|
src/widgets/dialogs/SelectChannelDialog.hpp \
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "singletons/Theme.hpp"
|
#include "singletons/Theme.hpp"
|
||||||
#include "util/CombinePath.hpp"
|
#include "util/CombinePath.hpp"
|
||||||
#include "widgets/dialogs/LogsPopup.hpp"
|
|
||||||
#include "widgets/dialogs/UserInfoPopup.hpp"
|
#include "widgets/dialogs/UserInfoPopup.hpp"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -416,45 +415,9 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
|||||||
}
|
}
|
||||||
else if (commandName == "/logs")
|
else if (commandName == "/logs")
|
||||||
{
|
{
|
||||||
if (words.size() < 2)
|
channel->addMessage(makeSystemMessage(
|
||||||
{
|
"Online logs functionality has been removed. If you're a "
|
||||||
channel->addMessage(
|
"moderator, you can use the /user command"));
|
||||||
makeSystemMessage("Usage: /logs [user] (channel)"));
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
auto app = getApp();
|
|
||||||
|
|
||||||
auto logs = new LogsPopup();
|
|
||||||
QString target = words.at(1);
|
|
||||||
|
|
||||||
if (target.at(0) == '@')
|
|
||||||
{
|
|
||||||
target = target.mid(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
logs->setTargetUserName(target);
|
|
||||||
|
|
||||||
std::shared_ptr<Channel> logsChannel = channel;
|
|
||||||
|
|
||||||
if (words.size() == 3)
|
|
||||||
{
|
|
||||||
QString channelName = words.at(2);
|
|
||||||
if (words.at(2).at(0) == '#')
|
|
||||||
{
|
|
||||||
channelName = channelName.mid(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
logs->setChannelName(channelName);
|
|
||||||
|
|
||||||
logsChannel =
|
|
||||||
app->twitch.server->getChannelOrEmpty(channelName);
|
|
||||||
}
|
|
||||||
|
|
||||||
logs->setChannel(logsChannel);
|
|
||||||
|
|
||||||
logs->getLogs();
|
|
||||||
logs->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
logs->show();
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
else if (commandName == "/user")
|
else if (commandName == "/user")
|
||||||
|
|||||||
@@ -1,136 +0,0 @@
|
|||||||
#include "LogsPopup.hpp"
|
|
||||||
|
|
||||||
#include "IrcMessage"
|
|
||||||
#include "common/Channel.hpp"
|
|
||||||
#include "common/NetworkRequest.hpp"
|
|
||||||
#include "messages/Message.hpp"
|
|
||||||
#include "providers/twitch/TwitchChannel.hpp"
|
|
||||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
|
||||||
#include "util/PostToThread.hpp"
|
|
||||||
#include "widgets/helper/ChannelView.hpp"
|
|
||||||
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
namespace chatterino {
|
|
||||||
|
|
||||||
LogsPopup::LogsPopup()
|
|
||||||
: channel_(Channel::getEmpty())
|
|
||||||
{
|
|
||||||
this->resize(400, 600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogsPopup::setChannel(const ChannelPtr &channel)
|
|
||||||
{
|
|
||||||
this->channel_ = channel;
|
|
||||||
this->updateWindowTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogsPopup::setChannelName(const QString &channelName)
|
|
||||||
{
|
|
||||||
this->channelName_ = channelName;
|
|
||||||
this->updateWindowTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogsPopup::setTargetUserName(const QString &userName)
|
|
||||||
{
|
|
||||||
this->userName_ = userName;
|
|
||||||
this->updateWindowTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogsPopup::updateWindowTitle()
|
|
||||||
{
|
|
||||||
this->setWindowTitle(this->userName_ + "'s logs in #" + this->channelName_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogsPopup::getLogs()
|
|
||||||
{
|
|
||||||
if (this->channel_ && !this->channel_->isEmpty())
|
|
||||||
{
|
|
||||||
if (auto twitchChannel =
|
|
||||||
dynamic_cast<TwitchChannel *>(this->channel_.get()))
|
|
||||||
{
|
|
||||||
this->channelName_ = twitchChannel->getName();
|
|
||||||
this->getOverrustleLogs();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->channelName_.isEmpty())
|
|
||||||
{
|
|
||||||
this->getOverrustleLogs();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
qDebug() << "Unable to get logs, no channel name or something specified";
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogsPopup::setMessages(std::vector<MessagePtr> &messages)
|
|
||||||
{
|
|
||||||
ChannelPtr logsChannel(new Channel("logs", Channel::Type::Misc));
|
|
||||||
|
|
||||||
logsChannel->addMessagesAtStart(messages);
|
|
||||||
SearchPopup::setChannel(logsChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogsPopup::getOverrustleLogs()
|
|
||||||
{
|
|
||||||
auto url =
|
|
||||||
QString("https://overrustlelogs.net/api/v1/stalk/%1/%2.json?limit=500")
|
|
||||||
.arg(this->channelName_, this->userName_);
|
|
||||||
|
|
||||||
NetworkRequest(url)
|
|
||||||
.caller(this)
|
|
||||||
.onError([this](NetworkResult) {
|
|
||||||
auto box = new QMessageBox(
|
|
||||||
QMessageBox::Information, "Error getting logs",
|
|
||||||
"No logs could be found for channel " + this->channelName_);
|
|
||||||
box->setWindowFlag(Qt::WindowStaysOnTopHint);
|
|
||||||
box->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
box->show();
|
|
||||||
box->raise();
|
|
||||||
this->close();
|
|
||||||
box->exec();
|
|
||||||
})
|
|
||||||
.onSuccess([this](auto result) -> Outcome {
|
|
||||||
auto data = result.parseJson();
|
|
||||||
std::vector<MessagePtr> messages;
|
|
||||||
if (data.contains("lines"))
|
|
||||||
{
|
|
||||||
QJsonArray dataMessages = data.value("lines").toArray();
|
|
||||||
for (auto i : dataMessages)
|
|
||||||
{
|
|
||||||
QJsonObject singleMessage = i.toObject();
|
|
||||||
auto text = singleMessage.value("text").toString();
|
|
||||||
QTime timeStamp =
|
|
||||||
QDateTime::fromSecsSinceEpoch(
|
|
||||||
singleMessage.value("timestamp").toInt())
|
|
||||||
.time();
|
|
||||||
|
|
||||||
MessageBuilder builder;
|
|
||||||
builder.emplace<TimestampElement>(timeStamp);
|
|
||||||
builder.emplace<TextElement>(this->userName_,
|
|
||||||
MessageElementFlag::Username,
|
|
||||||
MessageColor::System);
|
|
||||||
builder.emplace<TextElement>(text, MessageElementFlag::Text,
|
|
||||||
MessageColor::Text);
|
|
||||||
builder.message().messageText = text;
|
|
||||||
builder.message().displayName = this->userName_;
|
|
||||||
messages.push_back(builder.release());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
messages.push_back(
|
|
||||||
MessageBuilder(systemMessage,
|
|
||||||
"Logs provided by https://overrustlelogs.net")
|
|
||||||
.release());
|
|
||||||
this->setMessages(messages);
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
})
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace chatterino
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "widgets/helper/SearchPopup.hpp"
|
|
||||||
|
|
||||||
namespace chatterino {
|
|
||||||
|
|
||||||
class LogsPopup : public SearchPopup
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LogsPopup();
|
|
||||||
|
|
||||||
void setChannel(const ChannelPtr &channel) override;
|
|
||||||
void setChannelName(const QString &channelName);
|
|
||||||
void setTargetUserName(const QString &userName);
|
|
||||||
|
|
||||||
void getLogs();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void updateWindowTitle() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ChannelPtr channel_;
|
|
||||||
|
|
||||||
QString userName_;
|
|
||||||
QString channelName_;
|
|
||||||
|
|
||||||
void setMessages(std::vector<MessagePtr> &messages);
|
|
||||||
void getOverrustleLogs();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace chatterino
|
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "util/LayoutCreator.hpp"
|
#include "util/LayoutCreator.hpp"
|
||||||
#include "util/PostToThread.hpp"
|
#include "util/PostToThread.hpp"
|
||||||
#include "widgets/Label.hpp"
|
#include "widgets/Label.hpp"
|
||||||
#include "widgets/dialogs/LogsPopup.hpp"
|
|
||||||
#include "widgets/helper/EffectLabel.hpp"
|
#include "widgets/helper/EffectLabel.hpp"
|
||||||
#include "widgets/helper/Line.hpp"
|
#include "widgets/helper/Line.hpp"
|
||||||
|
|
||||||
@@ -113,8 +112,6 @@ UserInfoPopup::UserInfoPopup()
|
|||||||
user.emplace<QCheckBox>("Ignore").assign(&this->ui_.ignore);
|
user.emplace<QCheckBox>("Ignore").assign(&this->ui_.ignore);
|
||||||
user.emplace<QCheckBox>("Ignore highlights")
|
user.emplace<QCheckBox>("Ignore highlights")
|
||||||
.assign(&this->ui_.ignoreHighlights);
|
.assign(&this->ui_.ignoreHighlights);
|
||||||
auto viewLogs = user.emplace<EffectLabel2>(this);
|
|
||||||
viewLogs->getLabel().setText("Online logs");
|
|
||||||
auto usercard = user.emplace<EffectLabel2>(this);
|
auto usercard = user.emplace<EffectLabel2>(this);
|
||||||
usercard->getLabel().setText("Usercard");
|
usercard->getLabel().setText("Usercard");
|
||||||
|
|
||||||
@@ -127,15 +124,6 @@ UserInfoPopup::UserInfoPopup()
|
|||||||
|
|
||||||
user->addStretch(1);
|
user->addStretch(1);
|
||||||
|
|
||||||
QObject::connect(viewLogs.getElement(), &Button::leftClicked, [this] {
|
|
||||||
auto logs = new LogsPopup();
|
|
||||||
logs->setChannel(this->channel_);
|
|
||||||
logs->setTargetUserName(this->userName_);
|
|
||||||
logs->getLogs();
|
|
||||||
logs->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
logs->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
QObject::connect(usercard.getElement(), &Button::leftClicked, [this] {
|
QObject::connect(usercard.getElement(), &Button::leftClicked, [this] {
|
||||||
QDesktopServices::openUrl("https://www.twitch.tv/popout/" +
|
QDesktopServices::openUrl("https://www.twitch.tv/popout/" +
|
||||||
this->channel_->getName() +
|
this->channel_->getName() +
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ private:
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
Button *avatarButton = nullptr;
|
Button *avatarButton = nullptr;
|
||||||
// RippleEffectLabel2 *viewLogs = nullptr;
|
|
||||||
|
|
||||||
Label *nameLabel = nullptr;
|
Label *nameLabel = nullptr;
|
||||||
Label *viewCountLabel = nullptr;
|
Label *viewCountLabel = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user