Skip to content

Commit

Permalink
Users/rbrands/2021 07 28 3 (#88)
Browse files Browse the repository at this point in the history
* Bug fixing link preview

* Link added to image

* LinkPreview returned html-decoded, new version
  • Loading branch information
rbrands authored Aug 2, 2021
1 parent 5e40f57 commit e4c68cf
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion MeetUpFunctions/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions MeetUpFunctions/GetLinkPreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public async Task<IActionResult> 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;
Expand Down
2 changes: 1 addition & 1 deletion MeetUpPlanner/Client/Pages/About.razor
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</div>

@code {
private const string clientVersion = "2021-07-28-2";
private const string clientVersion = "2021-08-02";
private string serverVersion = "tbd";
private string functionsVersion = "tbd";

Expand Down
4 changes: 3 additions & 1 deletion MeetUpPlanner/Client/Pages/Calendar.razor
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
</div>
@if (!String.IsNullOrEmpty(item.LinkImage))
{
<img class="card-img-top" src="@item.LinkImage" alt="@item.LinkTitle">
<a href="@item.Link" target="_blank">
<img class="card-img-top" src="@item.LinkImage" alt="@item.LinkTitle">
</a>
}
<div class="card-body">
<h6 class="text-muted card-subtitle mb-2">
Expand Down
3 changes: 2 additions & 1 deletion MeetUpPlanner/Client/Pages/NewMeetUp.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -282,6 +282,7 @@
// Get referenced calendar item
meetup = await Http.GetFromJsonAsync<ExtendedCalendarItem>($"Calendar/extendedcalendaritem?itemId={ItemId}");
withoutHost = meetup.WithoutHost;
LinkPreviewEnabled = !String.IsNullOrEmpty(meetup.LinkImage);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion MeetUpPlanner/Server/Controllers/UtilController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class UtilController : ControllerBase
{
private readonly MeetUpFunctions _meetUpFunctions;
private readonly ILogger<UtilController> logger;
const string serverVersion = "2021-07-27";
const string serverVersion = "2021-08-02";
string functionsVersion = "tbd";

public UtilController(ILogger<UtilController> logger, MeetUpFunctions meetUpFunctions)
Expand Down

0 comments on commit e4c68cf

Please sign in to comment.