From e4c68cf47dd4da38b521180399ec781613761891 Mon Sep 17 00:00:00 2001 From: Robert Brands Date: Mon, 2 Aug 2021 18:34:38 +0200 Subject: [PATCH] Users/rbrands/2021 07 28 3 (#88) * Bug fixing link preview * Link added to image * LinkPreview returned html-decoded, new version --- MeetUpFunctions/Constants.cs | 2 +- MeetUpFunctions/GetLinkPreview.cs | 4 ++-- MeetUpPlanner/Client/Pages/About.razor | 2 +- MeetUpPlanner/Client/Pages/Calendar.razor | 4 +++- MeetUpPlanner/Client/Pages/NewMeetUp.razor | 3 ++- MeetUpPlanner/Server/Controllers/UtilController.cs | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/MeetUpFunctions/Constants.cs b/MeetUpFunctions/Constants.cs index 3281059..de3898a 100644 --- a/MeetUpFunctions/Constants.cs +++ b/MeetUpFunctions/Constants.cs @@ -22,7 +22,7 @@ public static class Constants public const string DEFAULT_DISCLAIMER = "Disclaimer"; public const string DEFAULT_GUEST_DISCLAIMER = "Guest Disclaimer"; - public const string VERSION = "2021-07-27"; + public const string VERSION = "2021-08-02"; public const int ADMINOVERBOOKFACTOR = 2; public const int LOG_TTL = 30 * 24 * 3600; // 30 days TTL for Log items diff --git a/MeetUpFunctions/GetLinkPreview.cs b/MeetUpFunctions/GetLinkPreview.cs index e000556..217abb7 100644 --- a/MeetUpFunctions/GetLinkPreview.cs +++ b/MeetUpFunctions/GetLinkPreview.cs @@ -55,8 +55,8 @@ public async Task Run( LinkPreviewRequest previewRequest = new LinkPreviewRequest(linkPreview.Url); LinkPreviewRequest previewResponse = await _linkPreviewRepository.GetLinkDataAsync(previewRequest, false, true, false, true); - linkPreview.Title = previewResponse.Result.Title; - linkPreview.Description = previewResponse.Result.Description; + linkPreview.Title = System.Web.HttpUtility.HtmlDecode(previewResponse.Result.Title); + linkPreview.Description = System.Web.HttpUtility.HtmlDecode(previewResponse.Result.Description); linkPreview.ImageUrl = previewResponse.Result.ImageUrl; linkPreview.Url = previewResponse.Result.Url; linkPreview.CanoncialUrl = previewResponse.Result.CanoncialUrl; diff --git a/MeetUpPlanner/Client/Pages/About.razor b/MeetUpPlanner/Client/Pages/About.razor index c7acb52..b5deeb8 100644 --- a/MeetUpPlanner/Client/Pages/About.razor +++ b/MeetUpPlanner/Client/Pages/About.razor @@ -51,7 +51,7 @@ @code { - private const string clientVersion = "2021-07-28-2"; + private const string clientVersion = "2021-08-02"; private string serverVersion = "tbd"; private string functionsVersion = "tbd"; diff --git a/MeetUpPlanner/Client/Pages/Calendar.razor b/MeetUpPlanner/Client/Pages/Calendar.razor index be28d1f..43f30c0 100644 --- a/MeetUpPlanner/Client/Pages/Calendar.razor +++ b/MeetUpPlanner/Client/Pages/Calendar.razor @@ -75,7 +75,9 @@ @if (!String.IsNullOrEmpty(item.LinkImage)) { - @item.LinkTitle + + @item.LinkTitle + }
diff --git a/MeetUpPlanner/Client/Pages/NewMeetUp.razor b/MeetUpPlanner/Client/Pages/NewMeetUp.razor index 38d91e5..dad7aa1 100644 --- a/MeetUpPlanner/Client/Pages/NewMeetUp.razor +++ b/MeetUpPlanner/Client/Pages/NewMeetUp.razor @@ -248,7 +248,7 @@ meetup.LinkImage = null; LinkPreviewEnabled = !LinkPreviewEnabled; this.StateHasChanged(); - if (LinkPreviewEnabled) + if (LinkPreviewEnabled && !String.IsNullOrEmpty(meetup.Link)) { LinkPreview linkPreview = new LinkPreview(); linkPreview.Url = new Uri(meetup.Link); @@ -282,6 +282,7 @@ // Get referenced calendar item meetup = await Http.GetFromJsonAsync($"Calendar/extendedcalendaritem?itemId={ItemId}"); withoutHost = meetup.WithoutHost; + LinkPreviewEnabled = !String.IsNullOrEmpty(meetup.LinkImage); } else { diff --git a/MeetUpPlanner/Server/Controllers/UtilController.cs b/MeetUpPlanner/Server/Controllers/UtilController.cs index 433128c..e68ecd9 100644 --- a/MeetUpPlanner/Server/Controllers/UtilController.cs +++ b/MeetUpPlanner/Server/Controllers/UtilController.cs @@ -20,7 +20,7 @@ public class UtilController : ControllerBase { private readonly MeetUpFunctions _meetUpFunctions; private readonly ILogger logger; - const string serverVersion = "2021-07-27"; + const string serverVersion = "2021-08-02"; string functionsVersion = "tbd"; public UtilController(ILogger logger, MeetUpFunctions meetUpFunctions)