1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-04 04:56:30 +03:00

Disable issue report button if dirty version detected (#275)

In this PR, I'm disabling the Report Issue button if a "dirty" version
is detected. This is done just in case so that "smart" developers don't
accidentally report a bug that they themselves created.

---------

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2024-03-20 15:59:25 +03:00 committed by GitHub
parent ecb92a318c
commit ca49231c86
Signed by: GitHub
GPG key ID: B5690EEEBB952194
8 changed files with 31 additions and 7 deletions

View file

@ -34,7 +34,7 @@ public static class BuildInfo
}
}
private static bool IsDirty
public static bool IsDirty
{
get
{

View file

@ -113,9 +113,12 @@ public class AboutCommandGroup : CommandGroup
var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
BuildInfo.IsDirty
? Messages.ButtonDirty
: Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: BuildInfo.IssuesUrl
URL: BuildInfo.IssuesUrl,
IsDisabled: BuildInfo.IsDirty
);
return await _feedback.SendContextualEmbedResultAsync(embed,

View file

@ -70,9 +70,12 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
BuildInfo.IsDirty
? Messages.ButtonDirty
: Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: BuildInfo.IssuesUrl
URL: BuildInfo.IssuesUrl,
IsDisabled: BuildInfo.IsDirty
);
return await _feedback.SendContextualEmbedResultAsync(embed,

View file

@ -1204,5 +1204,11 @@ namespace Octobot {
return ResourceManager.GetString("SettingsWelcomeMessagesChannel", resourceCulture);
}
}
internal static string ButtonDirty {
get {
return ResourceManager.GetString("ButtonDirty", resourceCulture);
}
}
}
}

View file

@ -115,9 +115,12 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
BuildInfo.IsDirty
? Messages.ButtonDirty
: Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: BuildInfo.IssuesUrl
URL: BuildInfo.IssuesUrl,
IsDisabled: BuildInfo.IsDirty
);
return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,