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

Pro 5937 move peer page #4530

Merged
merged 10 commits into from
May 23, 2024
Merged

Pro 5937 move peer page #4530

merged 10 commits into from
May 23, 2024

Conversation

haroun
Copy link
Contributor

@haroun haroun commented May 9, 2024

Summary

Recognize when the slug of a new child already contains the new parent's slug and not double it

What are the specific steps to test this change?

  1. npx mocha test/pages.js must be green.
  2. the Checks tab is green

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@haroun haroun self-assigned this May 9, 2024
@haroun haroun requested a review from boutell May 9, 2024 09:32
slugStem += '/';
}
moved.slug = moved.slug.replace(matchOldParentSlugPrefix, self.apos.util.addSlashIfNeeded(parent.slug));
const relativeSlug = path.relative(parent.slug, moved.slug);
Copy link
Member

Choose a reason for hiding this comment

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

Not suitable for page slugs because on some platforms it may return a platform-dependent path separator.

Copy link
Member

Choose a reason for hiding this comment

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

I know right now our documentation says native Windows is not supported, but it's not best practice to use path contrary to its intended purpose, and the way things are going with feedback from customers I think we will have to ease up and support native Node.js on Windows soon so let's not dig the hole deeper on that

test/pages.js Outdated
@@ -457,6 +457,79 @@ describe('Pages', function() {
assert.strictEqual(page.path, `${homeId.replace(':en:published', '')}/another-parent/parent/sibling`);
});

it('moving peer /parent/peer-page into /parent should ends with /parent/peer-page', async function() {
Copy link
Member

Choose a reason for hiding this comment

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

Please add coverage of the more common case as well, e.g. where the peers have slugs /a and /b and the outcome should be /a/b. Looking quickly over the existing tests I am not convinced we have that covered right now.

* main:
  cleanup
  unset marks on heading return
  language
  release 4.3.0
  fixes changelog typo
  uses NODE_ENV instead of APOS_DEV to guess vue alias
  simplifies vueProjectLevelPath const by using path.resolve
  prioritizes project level vue installation
  adds changelog
  adds function to set vue alias unique instance in dev mode
  Add alternative fix for "ungrouped" tab
  Hide single tab
  fix image cropper stencil getting smaller when changing aspect ratio (#4529)
  make a sparate AposWidgetModalTabs used only by AposWidgetEditor
  pass a limit prop to AposModalTabs
  fix cypress tests
@haroun haroun requested a review from boutell May 17, 2024 09:54
Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

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

I might be missing something but I still don't see this test:

/foo and /bar are peers
Move /bar under /foo
Should wind up with the slug /foo/bar

Just to cover that we didn't cause any regression in the more typical case.

.slice(0, -1)
.join('/');

moved.slug = parent.slug.endsWith(movedSlugCandidate)
Copy link
Member

Choose a reason for hiding this comment

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

Also I think this could be confused in the following scenario:

These are peers:

/foo
/foobar

(Note no second slash)

And the second one gets moved under the first.

That should result in:

/foo/foobar

(Because no slash)

Tests should cover this case.

Copy link
Member

Choose a reason for hiding this comment

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

This is in addition to the concern about testing plain old:

/foo
/bar

To make sure that when /bar is moved under /foo we still get /foo/bar in that typical case.

* main:
  Add test attributes
  release 4.3.2: hotfix for widget validation
  Fix widget validation, improve tabs annotation and UX
  fix migration bug that impacted our client demo, could impact other projects with stray documents corresponding to no module
  remove log
  when pasting content into RT dont force fit a valid class
  Center widget tab text
@haroun haroun requested a review from boutell May 21, 2024 12:33
Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

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

All looks great, except something funky happened to the changelog.

@@ -2,6 +2,35 @@

## UNRELEASED

### Changes

* Improves widget tabs for the hidden entries, improves UX when validation errors are present in non-focused tabs.
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated stuff in changelog?

CHANGELOG.md Outdated

* Databases containing documents that no longer correspond to any module no longer cause the migration that adds missing mode properties
to fail (an issue introduced in version 4.2.0). Databases with no such "orphaned" documents were not affected.
>>>>>>> main
Copy link
Member

Choose a reason for hiding this comment

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

Conflict not fully resolved?

@haroun haroun requested a review from boutell May 23, 2024 08:01
@haroun haroun merged commit 137aeb5 into main May 23, 2024
8 checks passed
@haroun haroun deleted the pro-5937-move-peer-page branch May 23, 2024 13:31
haroun added a commit that referenced this pull request May 23, 2024
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.

None yet

2 participants