Skip to content

Commit 6b6f52f

Browse files
authored
Merge pull request #80 from contentstack/staging
DX-1757 | Master
2 parents 2172f1c + 3f5d96d commit 6b6f52f

File tree

9 files changed

+41
-30
lines changed

9 files changed

+41
-30
lines changed

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fileignoreconfig:
1010
- filename: Contentstack.Core/Models/Asset.cs
1111
checksum: 98b819cb9b1e6a9a9e5394ac23c07bc642a41c0c7512d169afc63afe3baa6fb3
1212
- filename: Contentstack.Core/Models/Query.cs
13-
checksum: ceea632e4ea870f35ad3bd313e9f8b4e5ec21aa86f006fca2e0a32945999ba67
13+
checksum: eaf047e4ff77d92b5114f190e17fcc1e605bf8536e0406418d7ac1d0357d5110
1414
- filename: Contentstack.Core/Models/Taxonomy.cs
1515
checksum: db8bcefdc7aafde4286e7fb6d67348bec49f1ac27b54d84fddca8124135bd779
1616
- filename: .github/workflows/nuget-publish.yml

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### Version: 2.19.0
2+
#### Date: Nov-30-2024
3+
4+
##### Fix:
5+
- Remove updateLPContent call to resolve incorrect display of unsaved changes
6+
17
### Version: 2.18.0
28
#### Date: Nov-18-2024
39

Contentstack.AspNetCore/Contentstack.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.2"><PrivateAssets>all</PrivateAssets>
3232
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3333
</PackageReference>
34-
<PackageReference Include="contentstack.csharp" Version="2.17.0" />
34+
<PackageReference Include="contentstack.csharp" Version="2.18.0" />
3535
</ItemGroup>
3636
</Project>

Contentstack.Core.Tests/Contentstack.Core.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
12-
<PackageReference Include="xunit" Version="2.7.0" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
12+
<PackageReference Include="xunit" Version="2.9.2" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>
16-
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
17-
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
16+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
17+
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
1818
<PackageReference Include="coverlet.collector" Version="6.0.2">
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
<PrivateAssets>all</PrivateAssets>

Contentstack.Core/Configuration/Config.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ internal string getLivePreviewUrl(LivePreviewConfig livePreviewConfig)
9999

100100
internal string getBaseUrl (LivePreviewConfig livePreviewConfig, string contentTypeUID)
101101
{
102-
if (livePreviewConfig != null && livePreviewConfig.Enable && livePreviewConfig.ContentTypeUID == contentTypeUID)
102+
if (livePreviewConfig != null
103+
&& livePreviewConfig.Enable
104+
&& livePreviewConfig.LivePreview != "init"
105+
&& livePreviewConfig.ContentTypeUID == contentTypeUID)
103106
{
104107
return getLivePreviewUrl(livePreviewConfig);
105108
}

Contentstack.Core/ContentstackClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ public async Task LivePreviewQueryAsync(Dictionary<string, string> query)
572572
string hash = null;
573573
query.TryGetValue("live_preview", out hash);
574574
this.LivePreviewConfig.LivePreview = hash;
575+
} else {
576+
this.LivePreviewConfig.LivePreview = "init";
575577
}
576578
this.LivePreviewConfig.PreviewResponse = await GetLivePreviewData();
577579
}

Contentstack.Core/Internals/HttpRequestHandler.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public async Task<string> ProcessRequest(string Url, Dictionary<string, object>
4848
var request = (HttpWebRequest)WebRequest.Create(uri);
4949
request.Method = "GET";
5050
request.ContentType = "application/json";
51-
request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.18.0";
51+
request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.19.0";
5252
request.Timeout = timeout;
5353

5454
if (proxy != null)
@@ -90,13 +90,6 @@ public async Task<string> ProcessRequest(string Url, Dictionary<string, object>
9090
{
9191
responseString = await plugin.OnResponse(client, request, response, responseString);
9292
}
93-
94-
if (isLivePreview == false && this.client.LivePreviewConfig.Enable == true)
95-
{
96-
JObject data = JsonConvert.DeserializeObject<JObject>(responseString.Replace("\r\n", ""), this.client.SerializerSettings);
97-
updateLivePreviewContent(data);
98-
responseString = JsonConvert.SerializeObject(data);
99-
}
10093
return responseString;
10194
} else {
10295
return null;

Contentstack.Core/Models/Query.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,19 +1830,6 @@ private async Task<JObject> Exec()
18301830
Dictionary<string, object> headerAll = new Dictionary<string, object>();
18311831
Dictionary<string, object> mainJson = new Dictionary<string, object>();
18321832

1833-
if (headers != null && headers.Count() > 0)
1834-
{
1835-
foreach (var header in headers)
1836-
{
1837-
if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
1838-
&& this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId
1839-
&& header.Key == "access_token")
1840-
{
1841-
continue;
1842-
}
1843-
headerAll.Add(header.Key, (string)header.Value);
1844-
}
1845-
}
18461833
bool isLivePreview = false;
18471834
if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
18481835
&& this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId)
@@ -1859,7 +1846,27 @@ private async Task<JObject> Exec()
18591846

18601847
isLivePreview = true;
18611848
}
1849+
1850+
if (headers != null && headers.Count() > 0)
1851+
{
1852+
foreach (var header in headers)
1853+
{
1854+
if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
1855+
&& this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId
1856+
&& header.Key == "access_token"
1857+
&& isLivePreview)
1858+
{
1859+
continue;
1860+
}
1861+
headerAll.Add(header.Key, (string)header.Value);
1862+
}
1863+
}
18621864

1865+
if (!isLivePreview && headerAll.ContainsKey("preview_token"))
1866+
{
1867+
headerAll.Remove("preview_token");
1868+
}
1869+
18631870
mainJson.Add("environment", this.ContentTypeInstance.StackInstance.Config.Environment);
18641871
if (QueryValueJson != null && QueryValueJson.Count > 0)
18651872
mainJson.Add("query", QueryValueJson);

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>2.18.0</Version>
3+
<Version>2.19.0</Version>
44
</PropertyGroup>
55
</Project>

0 commit comments

Comments
 (0)