Skip to content

Commit f1fade9

Browse files
authored
DYN-6107: Disable publish online option for non package owner (#17200)
1 parent c1bf718 commit f1fade9

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/DynamoCoreWpf/DynamoCoreWpf.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494

9595
<Target Name="NpmRunBuildPMWizard" BeforeTargets="BeforeBuild">
9696
<PropertyGroup>
97-
<PackageVersion>0.0.27</PackageVersion>
97+
<PackageVersion>0.0.28</PackageVersion>
9898
<PackageName>PackageManagerWizard</PackageName>
9999
</PropertyGroup>
100100
<Exec Command="$(PowerShellCommand) -ExecutionPolicy Bypass -File &quot;$(SolutionDir)pkgexist.ps1&quot; &quot;$(PackageName)&quot; &quot;$(PackageVersion)&quot;" ConsoleToMSBuild="true">

src/DynamoCoreWpf/Views/PackageManager/Components/PackageManagerWizard/PackageManagerWizard.xaml.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -543,23 +543,30 @@ private async void SendPackageUpdates(PublishPackageViewModel vm)
543543
var jsonSerializer = Newtonsoft.Json.JsonSerializer.Create(jsonSerializerSettings);
544544
var rootObj = JObject.FromObject(payload, jsonSerializer);
545545

546-
// Include payload.versions[*].compatibility_matrix for the "Copy from" dropdown.
547-
try
546+
if (rootObj["payload"] is JObject payloadObj)
548547
{
549-
var header = await TryGetPackageHeaderAsync(vm);
550-
if (header != null)
548+
// Present with safe defaults so the frontend always has a consistent shape
549+
payloadObj["versions"] = new JArray();
550+
payloadObj["maintainers"] = new JArray();
551+
552+
try
551553
{
552-
if (rootObj["payload"] is JObject payloadObj)
554+
var header = await TryGetPackageHeaderAsync(vm);
555+
if (header != null)
553556
{
554557
payloadObj["versions"] = header.versions != null
555-
? JToken.FromObject(header.versions, jsonSerializer)
558+
? JToken.FromObject(header.versions, jsonSerializer)
559+
: new JArray();
560+
561+
payloadObj["maintainers"] = header.maintainers != null
562+
? JToken.FromObject(header.maintainers, jsonSerializer)
556563
: new JArray();
557564
}
558565
}
559-
}
560-
catch (Exception ex)
561-
{
562-
LogMessage(ex);
566+
catch (Exception ex)
567+
{
568+
LogMessage(ex);
569+
}
563570
}
564571

565572
var jsonPayload = rootObj.ToString(Newtonsoft.Json.Formatting.None);

0 commit comments

Comments
 (0)