summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-05-14 03:08:27 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-05-14 03:08:27 -0400
commitf53b9742cb6f8e9b3e6c3c18344fbe9193a4e438 (patch)
tree4658a2e13e915df1903399a3c755e3ad5c4dd48b /windows
parentcd97c554651a4940131eec5e694632dc0d084928 (diff)
downloadabaddon-portaudio-f53b9742cb6f8e9b3e6c3c18344fbe9193a4e438.tar.gz
abaddon-portaudio-f53b9742cb6f8e9b3e6c3c18344fbe9193a4e438.zip
handle stage-related audit log action types
Diffstat (limited to 'windows')
-rw-r--r--windows/guildsettings/auditlogpane.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/windows/guildsettings/auditlogpane.cpp b/windows/guildsettings/auditlogpane.cpp
index f586459..02fd557 100644
--- a/windows/guildsettings/auditlogpane.cpp
+++ b/windows/guildsettings/auditlogpane.cpp
@@ -460,6 +460,82 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
target_user->GetEscapedString() +
"</b>";
} break;
+ case AuditLogActionType::STAGE_INSTANCE_CREATE: {
+ const auto channel = discord.GetChannel(*entry.Options->ChannelID);
+ if (channel.has_value()) {
+ markup = user_markup +
+ " started the stage for <b>" +
+ Glib::Markup::escape_text(*channel->Name) +
+ "</b>";
+ } else {
+ markup = user_markup +
+ " started the stage for <b>" +
+ std::to_string(*entry.Options->ChannelID) +
+ "</b>";
+ }
+
+ if (entry.Changes.has_value()) {
+ for (const auto &change : *entry.Changes) {
+ if (change.Key == "topic" && change.NewValue.has_value()) {
+ extra_markup.push_back(
+ "Set the topic to <b>" +
+ Glib::Markup::escape_text(change.NewValue->get<std::string>()) +
+ "</b>");
+ } else if (change.Key == "privacy_level" && change.NewValue.has_value()) {
+ Glib::ustring str = Glib::Markup::escape_text(GetStagePrivacyDisplayString(change.NewValue->get<StagePrivacy>()));
+ extra_markup.push_back(
+ "Set the privacy level to <b>" +
+ str +
+ "</b>");
+ }
+ }
+ }
+ } break;
+ case AuditLogActionType::STAGE_INSTANCE_UPDATE: {
+ const auto channel = discord.GetChannel(*entry.Options->ChannelID);
+ if (channel.has_value()) {
+ markup = user_markup +
+ " updated the stage for <b>" +
+ Glib::Markup::escape_text(*channel->Name) +
+ "</b>";
+ } else {
+ markup = user_markup +
+ " updated the stage for <b>" +
+ std::to_string(*entry.Options->ChannelID) +
+ "</b>";
+ }
+
+ if (entry.Changes.has_value()) {
+ for (const auto &change : *entry.Changes) {
+ if (change.Key == "topic" && change.NewValue.has_value()) {
+ extra_markup.push_back(
+ "Set the topic to <b>" +
+ Glib::Markup::escape_text(change.NewValue->get<std::string>()) +
+ "</b>");
+ } else if (change.Key == "privacy_level" && change.NewValue.has_value()) {
+ Glib::ustring str = Glib::Markup::escape_text(GetStagePrivacyDisplayString(change.NewValue->get<StagePrivacy>()));
+ extra_markup.push_back(
+ "Set the privacy level to <b>" +
+ str +
+ "</b>");
+ }
+ }
+ }
+ } break;
+ case AuditLogActionType::STAGE_INSTANCE_DELETE: {
+ const auto channel = discord.GetChannel(*entry.Options->ChannelID);
+ if (channel.has_value()) {
+ markup = user_markup +
+ " ended the stage for <b>" +
+ Glib::Markup::escape_text(*channel->Name) +
+ "</b>";
+ } else {
+ markup = user_markup +
+ " ended the stage for <b>" +
+ std::to_string(*entry.Options->ChannelID) +
+ "</b>";
+ }
+ } break;
default:
markup = "<i>Unknown action</i>";
break;