silverstripe / silverstripe-linkfield

Silverstripe module for managing links
BSD 3-Clause "New" or "Revised" License
4 stars 14 forks source link

CMS 5.2.0-beta1. Regression test: Versioned label should be on both sorted links #254

Closed sabina-talipova closed 3 months ago

sabina-talipova commented 3 months ago

Description

Executed on: SC PHP 8.3 Chrome Sink

When sorting links using Drag and Drop, the version label does not always appear on the first link in the list. This behavior is not permanent and can work correctly from case to case.

Steps to reproduce issue:

My expectation that both links should be marked as "Modified".

Acceptance criteria

GuySartorelli commented 3 months ago

Check in the DB and see if the sort value has actually changed for both links. If Sort hasn't changed for one of the links, then the link hasn't actually been modified.

sabina-talipova commented 3 months ago

This happens for two identical scenarios in a row. For example, I expect that first Link should have Sort = 1 and second Link should have Sort = 2. When we change their position in the list(reorder two first links), I expect that first Link will have Sort = 2 and second Link has Sort = 1. Should we expect to having a badge in LinkField in this case? In any case something goes wrong, since sometimes we see badge, sometimes not.

maxime-rainville commented 3 months ago

To the extent that modified label reflects the underlying state of the object, I'm not overly fuss about how the sorting works.

I'm not too concern about the sorting algo works under the hood.

Let's say you have item 1, 2, 3 and 4. You change item 2 to come first:

maxime-rainville commented 3 months ago

I suspect that part of the problem is that new Link, seem to default to having a Sort of 1.

Repo steps

Expected results: New link is at the end of the list. Actual results: New link is in the second spot.

If you look at the DB, you'll find that the new link has a Sort of 1. It's showing up in the second spot because one other link will have a Sort of 1.

linkfield-2024-03-18_17.07.39.webm

sabina-talipova commented 3 months ago

I assume that this issue can be solved as part of this issue https://github.com/silverstripe/silverstripe-linkfield/issues/258

sabina-talipova commented 3 months ago

Issue was solved by https://github.com/silverstripe/silverstripe-linkfield/pull/262. Close ticket.