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

Beyond Retail - updates for Blog migration to v11 + bugfixes + reimplementing missing bits from v7 package #30

Open
wants to merge 15 commits into
base: v10/master
Choose a base branch
from

Conversation

MDuncan98
Copy link

Migrated package so that it can be used in .NET core, as part of the BR blog migration.

{
values.Add(ExamineFields.Tag, tags.Select(t => t.ToLower()));
// Tags are likely csv rather than JSON
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep this comment here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think it explains what's going on cuz it might seem a bit weird that we try to deserialize this value, then do a string.Split() - makes it known this is intentional.

Don't feel strongly about it either way though

@tristanjthompson tristanjthompson changed the title Update Gibe.Umbraco.Blog to support .NET core Beyond Retail - updates for Blog migration to v11 + bugfixes + reimplementing missing bits from v7 package Sep 6, 2023
Comment on lines +142 to +144
else if (UdiParser.TryParse(authorIdString, out var authorUid))
{
authorName = GetAuthorName(authorUid);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: typo

Suggested change
else if (UdiParser.TryParse(authorIdString, out var authorUid))
{
authorName = GetAuthorName(authorUid);
else if (UdiParser.TryParse(authorIdString, out var authorUdi))
{
authorName = GetAuthorName(authorUdi);

var authorId = e.ValueSet.GetSingleValue<int?>(ExamineFields.PostAuthor);
var authorIdString = e.ValueSet.GetSingleValue(ExamineFields.PostAuthor);
var authorName = string.Empty;
if(int.TryParse(authorIdString, out var authorId))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick/readability: Maybe to make this clearer for future code-readers, we could put this into a local method?

Suggested change
if(int.TryParse(authorIdString, out var authorId))
if(IsUmbracoUserId(authorIdString, out var authorId))

{
authorName = GetUserName(authorId);
}
else if (UdiParser.TryParse(authorIdString, out var authorUid))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick/readability: Maybe to make this clearer for future code-readers, we could put this into a local method?

Suggested change
else if (UdiParser.TryParse(authorIdString, out var authorUid))
else if (IsContentNodeUdi(authorIdString, out var authorUdi))

{
values.Add(ExamineFields.Tag, tags.Select(t => t.ToLower()));
// Tags are likely csv rather than JSON

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think it explains what's going on cuz it might seem a bit weird that we try to deserialize this value, then do a string.Split() - makes it known this is intentional.

Don't feel strongly about it either way though

Comment on lines +237 to +241
private string GetAuthorName(Udi authorUid)
{
using (var context = _umbracoContextFactory.EnsureUmbracoContext())
{
return context.UmbracoContext.Content.GetById(authorUid)?.Name ?? string.Empty;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick/Typo:

Suggested change
private string GetAuthorName(Udi authorUid)
{
using (var context = _umbracoContextFactory.EnsureUmbracoContext())
{
return context.UmbracoContext.Content.GetById(authorUid)?.Name ?? string.Empty;
private string GetAuthorName(Udi authorUdi)
{
using (var context = _umbracoContextFactory.EnsureUmbracoContext())
{
return context.UmbracoContext.Content.GetById(authorUdi)?.Name ?? string.Empty;

Comment on lines 19 to 22
public string BlogPostDocumentTypeAlias => _settingsService.GetSetting("Gibe.Umbraco.Blog.BlogPostDocumentTypeAlias", "blogPost");
public string BlogSectionDocumentTypeAlias => _settingsService.GetSetting("Gibe.Umbraco.Blog.BlogSectionDocumentTypeAlias", "blogSection");

public string UserPickerPropertyEditorAlias => _settingsService.GetSetting("Gibe.Umbraco.Blog.UserPickerPropertyEditorAlias", "Umbraco.UserPicker");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Seems strange this class is called "HardCodedBlogSettings" and then doesn't use hard-coded values - these don't seem very hard-coded to me! Should the class be renamed for framework? Maybe GibeSettingsBlogSettings?

Don't have hugely strong opinions either way on this though.

@tristanjthompson tristanjthompson force-pushed the v10/feature/beyond-retail-blog-migration branch from ca92c6d to 4e68dc8 Compare September 8, 2023 13:59
@tristanjthompson tristanjthompson force-pushed the v10/feature/beyond-retail-blog-migration branch from 4e68dc8 to a1f3700 Compare September 8, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants