fix: end tab bar in reporting window
This commit is contained in:
parent
639c48ff61
commit
3fa636d110
|
@ -294,7 +294,8 @@ namespace NoSoliciting {
|
||||||
|
|
||||||
string sender = message.Sender.Payloads
|
string sender = message.Sender.Payloads
|
||||||
.Where(payload => payload.Type == PayloadType.RawText)
|
.Where(payload => payload.Type == PayloadType.RawText)
|
||||||
.Select(payload => (payload as TextPayload).Text)
|
.Cast<TextPayload>()
|
||||||
|
.Select(payload => payload.Text)
|
||||||
.FirstOrDefault() ?? "";
|
.FirstOrDefault() ?? "";
|
||||||
|
|
||||||
if (AddColumn(maxSizes, message.Timestamp.ToString(CultureInfo.CurrentCulture), message.ChatType.ToString(), message.FilterReason ?? "", sender, message.Content.TextValue)) {
|
if (AddColumn(maxSizes, message.Timestamp.ToString(CultureInfo.CurrentCulture), message.ChatType.ToString(), message.FilterReason ?? "", sender, message.Content.TextValue)) {
|
||||||
|
@ -357,6 +358,8 @@ namespace NoSoliciting {
|
||||||
}
|
}
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.EndTabBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
|
@ -364,54 +367,56 @@ namespace NoSoliciting {
|
||||||
|
|
||||||
private void SetUpReportModal(Message message) {
|
private void SetUpReportModal(Message message) {
|
||||||
ImGui.SetNextWindowSize(new Vector2(350, -1));
|
ImGui.SetNextWindowSize(new Vector2(350, -1));
|
||||||
if (ImGui.BeginPopupModal($"Report to NoSoliciting###modal-message-{message.Id}")) {
|
if (!ImGui.BeginPopupModal($"Report to NoSoliciting###modal-message-{message.Id}")) {
|
||||||
ImGui.PushTextWrapPos();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.Text("Reporting this message will let the developer know that you think this message was incorrectly classified.");
|
ImGui.PushTextWrapPos();
|
||||||
|
|
||||||
if (message.FilterReason != null) {
|
ImGui.Text("Reporting this message will let the developer know that you think this message was incorrectly classified.");
|
||||||
ImGui.Text("Specifically, this message WAS filtered but shouldn't have been.");
|
|
||||||
} else {
|
|
||||||
ImGui.Text("Specifically, this message WAS NOT filtered but should have been.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.Separator();
|
if (message.FilterReason != null) {
|
||||||
|
ImGui.Text("Specifically, this message WAS filtered but shouldn't have been.");
|
||||||
|
} else {
|
||||||
|
ImGui.Text("Specifically, this message WAS NOT filtered but should have been.");
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.Text(message.Content.TextValue);
|
ImGui.Separator();
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Text(message.Content.TextValue);
|
||||||
|
|
||||||
if (message.FilterReason == "custom") {
|
ImGui.Separator();
|
||||||
ImGui.TextColored(new Vector4(1f, 0f, 0f, 1f), "You cannot report messages filtered because of a custom filter.");
|
|
||||||
} else {
|
if (message.FilterReason == "custom") {
|
||||||
if (ImGui.Button("Report")) {
|
ImGui.TextColored(new Vector4(1f, 0f, 0f, 1f), "You cannot report messages filtered because of a custom filter.");
|
||||||
Task.Run(async () => {
|
} else {
|
||||||
string resp = null;
|
if (ImGui.Button("Report")) {
|
||||||
try {
|
Task.Run(async () => {
|
||||||
using (WebClient client = new WebClient()) {
|
string resp = null;
|
||||||
this.lastReportStatus = ReportStatus.InProgress;
|
try {
|
||||||
resp = await client.UploadStringTaskAsync(this.plugin.Definitions.ReportUrl, message.ToJson()).ConfigureAwait(true);
|
using (WebClient client = new WebClient()) {
|
||||||
}
|
this.lastReportStatus = ReportStatus.InProgress;
|
||||||
|
resp = await client.UploadStringTaskAsync(this.plugin.Definitions.ReportUrl, message.ToJson()).ConfigureAwait(true);
|
||||||
|
}
|
||||||
#pragma warning disable CA1031 // Do not catch general exception types
|
#pragma warning disable CA1031 // Do not catch general exception types
|
||||||
} catch (Exception) { }
|
} catch (Exception) { }
|
||||||
#pragma warning restore CA1031 // Do not catch general exception types
|
#pragma warning restore CA1031 // Do not catch general exception types
|
||||||
this.lastReportStatus = resp == "{\"message\":\"ok\"}" ? ReportStatus.Successful : ReportStatus.Failure;
|
this.lastReportStatus = resp == "{\"message\":\"ok\"}" ? ReportStatus.Successful : ReportStatus.Failure;
|
||||||
PluginLog.Log($"Report sent. Response: {resp}");
|
PluginLog.Log($"Report sent. Response: {resp}");
|
||||||
});
|
});
|
||||||
ImGui.CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.SameLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.Button("Cancel")) {
|
|
||||||
ImGui.CloseCurrentPopup();
|
ImGui.CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopTextWrapPos();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGui.EndPopup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui.Button("Cancel")) {
|
||||||
|
ImGui.CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.PopTextWrapPos();
|
||||||
|
|
||||||
|
ImGui.EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum ReportStatus {
|
private enum ReportStatus {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user