Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX-1757 | Master #80

Merged
merged 8 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fileignoreconfig:
- filename: Contentstack.Core/Models/Asset.cs
checksum: 98b819cb9b1e6a9a9e5394ac23c07bc642a41c0c7512d169afc63afe3baa6fb3
- filename: Contentstack.Core/Models/Query.cs
checksum: ceea632e4ea870f35ad3bd313e9f8b4e5ec21aa86f006fca2e0a32945999ba67
checksum: eaf047e4ff77d92b5114f190e17fcc1e605bf8536e0406418d7ac1d0357d5110
- filename: Contentstack.Core/Models/Taxonomy.cs
checksum: db8bcefdc7aafde4286e7fb6d67348bec49f1ac27b54d84fddca8124135bd779
- filename: .github/workflows/nuget-publish.yml
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version: 2.19.0
#### Date: Nov-30-2024

##### Fix:
- Remove updateLPContent call to resolve incorrect display of unsaved changes

### Version: 2.18.0
#### Date: Nov-18-2024

Expand Down
2 changes: 1 addition & 1 deletion Contentstack.AspNetCore/Contentstack.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.2"><PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="contentstack.csharp" Version="2.17.0" />
<PackageReference Include="contentstack.csharp" Version="2.18.0" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions Contentstack.Core.Tests/Contentstack.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
5 changes: 4 additions & 1 deletion Contentstack.Core/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ internal string getLivePreviewUrl(LivePreviewConfig livePreviewConfig)

internal string getBaseUrl (LivePreviewConfig livePreviewConfig, string contentTypeUID)
{
if (livePreviewConfig != null && livePreviewConfig.Enable && livePreviewConfig.ContentTypeUID == contentTypeUID)
if (livePreviewConfig != null
&& livePreviewConfig.Enable
&& livePreviewConfig.LivePreview != "init"
&& livePreviewConfig.ContentTypeUID == contentTypeUID)
{
return getLivePreviewUrl(livePreviewConfig);
}
Expand Down
2 changes: 2 additions & 0 deletions Contentstack.Core/ContentstackClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ public async Task LivePreviewQueryAsync(Dictionary<string, string> query)
string hash = null;
query.TryGetValue("live_preview", out hash);
this.LivePreviewConfig.LivePreview = hash;
} else {
this.LivePreviewConfig.LivePreview = "init";
}
this.LivePreviewConfig.PreviewResponse = await GetLivePreviewData();
}
Expand Down
9 changes: 1 addition & 8 deletions Contentstack.Core/Internals/HttpRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task<string> ProcessRequest(string Url, Dictionary<string, object>
var request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "GET";
request.ContentType = "application/json";
request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.18.0";
request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.19.0";
request.Timeout = timeout;

if (proxy != null)
Expand Down Expand Up @@ -90,13 +90,6 @@ public async Task<string> ProcessRequest(string Url, Dictionary<string, object>
{
responseString = await plugin.OnResponse(client, request, response, responseString);
}

if (isLivePreview == false && this.client.LivePreviewConfig.Enable == true)
{
JObject data = JsonConvert.DeserializeObject<JObject>(responseString.Replace("\r\n", ""), this.client.SerializerSettings);
updateLivePreviewContent(data);
responseString = JsonConvert.SerializeObject(data);
}
return responseString;
} else {
return null;
Expand Down
33 changes: 20 additions & 13 deletions Contentstack.Core/Models/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,19 +1830,6 @@ private async Task<JObject> Exec()
Dictionary<string, object> headerAll = new Dictionary<string, object>();
Dictionary<string, object> mainJson = new Dictionary<string, object>();

if (headers != null && headers.Count() > 0)
{
foreach (var header in headers)
{
if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
&& this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId
&& header.Key == "access_token")
{
continue;
}
headerAll.Add(header.Key, (string)header.Value);
}
}
bool isLivePreview = false;
if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
&& this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId)
Expand All @@ -1859,7 +1846,27 @@ private async Task<JObject> Exec()

isLivePreview = true;
}

if (headers != null && headers.Count() > 0)
{
foreach (var header in headers)
{
if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
&& this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId
&& header.Key == "access_token"
&& isLivePreview)
{
continue;
}
headerAll.Add(header.Key, (string)header.Value);
}
}

if (!isLivePreview && headerAll.ContainsKey("preview_token"))
{
headerAll.Remove("preview_token");
}

mainJson.Add("environment", this.ContentTypeInstance.StackInstance.Config.Environment);
if (QueryValueJson != null && QueryValueJson.Count > 0)
mainJson.Add("query", QueryValueJson);
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>2.18.0</Version>
<Version>2.19.0</Version>
</PropertyGroup>
</Project>
Loading