mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 19:19:47 +00:00
Refactored DEPRECATION_MESSAGE to use an empty string when not needed
This commit is contained in:
parent
544e9ee561
commit
f72eef2b95
@ -1,3 +1,5 @@
|
||||
require("contentHome")
|
||||
|
||||
-- The ID for this plugin:
|
||||
ID = "43065dbc-78d0-45b7-92be-f14c2926e2dc"
|
||||
|
||||
@ -32,7 +34,7 @@ TARGET_GROUPS = { "EVERYONE" }
|
||||
IS_MAINTAINED = true
|
||||
|
||||
-- When the plugin is deprecated, this message will be shown to users:
|
||||
DEPRECATION_MESSAGE = nil
|
||||
DEPRECATION_MESSAGE = ""
|
||||
|
||||
UI_TEXT_CONTENT = {
|
||||
HOME = CONTENT_HOME,
|
||||
|
@ -34,7 +34,7 @@ TARGET_GROUPS = { "EVERYONE" }
|
||||
IS_MAINTAINED = true
|
||||
|
||||
-- When the plugin is deprecated, this message will be shown to users:
|
||||
DEPRECATION_MESSAGE = nil
|
||||
DEPRECATION_MESSAGE = ""
|
||||
|
||||
UI_TEXT_CONTENT = {
|
||||
HOME = CONTENT_HOME,
|
||||
|
@ -60,5 +60,5 @@ public interface IPluginMetadata
|
||||
/// <summary>
|
||||
/// The message that should be displayed when the plugin is deprecated.
|
||||
/// </summary>
|
||||
public string? DeprecationMessage { get; }
|
||||
public string DeprecationMessage { get; }
|
||||
}
|
@ -48,7 +48,7 @@ public abstract class PluginBase : IPluginMetadata
|
||||
public bool IsMaintained { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? DeprecationMessage { get; }
|
||||
public string DeprecationMessage { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The issues that occurred during the initialization of this plugin.
|
||||
@ -418,12 +418,12 @@ public abstract class PluginBase : IPluginMetadata
|
||||
/// <param name="message">The error message, when the deprecation message could not be read.</param>
|
||||
/// <param name="deprecationMessage">The read deprecation message.</param>
|
||||
/// <returns>True, when the deprecation message could be read successfully.</returns>
|
||||
private bool TryInitDeprecationMessage(out string message, out string? deprecationMessage)
|
||||
private bool TryInitDeprecationMessage(out string message, out string deprecationMessage)
|
||||
{
|
||||
if (!this.state.Environment["DEPRECATION_MESSAGE"].TryRead(out deprecationMessage))
|
||||
{
|
||||
deprecationMessage = null;
|
||||
message = "The field DEPRECATION_MESSAGE does not exist, is not a valid string. This field is optional: use nil to indicate that the plugin is not deprecated.";
|
||||
deprecationMessage = string.Empty;
|
||||
message = "The field DEPRECATION_MESSAGE does not exist, is not a valid string. This message is optional: use an empty string to indicate that the plugin is not deprecated.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public sealed class PluginMetadata(PluginBase plugin) : IPluginMetadata
|
||||
public bool IsMaintained { get; } = plugin.IsMaintained;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? DeprecationMessage { get; } = plugin.DeprecationMessage;
|
||||
public string DeprecationMessage { get; } = plugin.DeprecationMessage;
|
||||
|
||||
#endregion
|
||||
}
|
Loading…
Reference in New Issue
Block a user