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

Fixes for day 2 of .NET Conf #302

Merged
merged 4 commits into from
Nov 15, 2023
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 src/TagzApp.Providers.YouTubeChat/YouTubeChatProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public async Task<IEnumerable<Content>> GetContentForHashtag(Hashtag tag, DateTi
}

_Status = SocialMediaStatus.Healthy;
_StatusMessage = "OK";
_StatusMessage = $"OK -- adding ({contents.Items.Count}) messages at {DateTimeOffset.UtcNow}";

return contents.Items.Select(i => new Content
{
Expand Down
3 changes: 2 additions & 1 deletion src/TagzApp.Storage.Postgres/AzureSafetyModeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public void NotifyNewContent(string hashtag, Content content)
catch (RequestFailedException ex)
{
_AzureSafetyLogger.LogError(ex, "Analyze text failed.\nStatus code: {0}, Error code: {1}, Error message: {2}", ex.Status, ex.ErrorCode, ex.Message);
throw;
_NotifyNewMessages.NotifyNewContent(hashtag, content);
return;
}

if (response != null && (response.Value.SexualResult.Severity > 0 || response.Value.HateResult.Severity > 0 || response.Value.SelfHarmResult.Severity > 0 || response.Value.ViolenceResult.Severity > 0))
Expand Down
1 change: 1 addition & 0 deletions src/TagzApp.Web/Areas/Admin/Pages/Providers.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
aria-labelledby="heading-@provider.Id"
data-bs-parent="#providerAccordion">
<p class="ps-3 pt-3 mb-1">@provider.Description</p>
<p class="ps-3 pt-3 mb-1"><b>Status:</b> @health.Status - @health.Message</p>
<p class="ps-3 pt-3 mb-0 fst-italic">Please fill in the configuration values below:</p>
<form method="post" class="p-3" id="@($"{provider.Id}-form")">
<input type="hidden" id="Name" name="Name" value="@provider.DisplayName" />
Expand Down
14 changes: 14 additions & 0 deletions src/TagzApp.Web/wwwroot/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
var approvedFilterStatus = ApprovalFilter.All;
var providerFilter = [];
var cursorProviderId = null;
var currentModal = null;

const waterfallMaxEntries = 100;
const moderationMaxEntries = 500;
Expand Down Expand Up @@ -156,6 +157,9 @@
newMessage.addEventListener('click', function (ev) {
var el = ev.target.closest('article');

if (currentModal == content.providerId) return;
currentModal = content.providerId;

connection.invoke(
'SendMessageToOverlay',
window.TagzApp.Tags[0],
Expand Down Expand Up @@ -984,6 +988,16 @@
});
});

// Listen for the DisplayOverlay event and display the modal for the selected message
connection.on('DisplayOverlay', (content) => {
var item = document.querySelector(
`[data-providerid='${content.providerId}']`,
);
if (item) {
item.click();
}
});

// Start the connection.
await start();

Expand Down