Page MenuHomePhabricator

Define equality for PageIdentity and LinkTarget
Closed, ResolvedPublic

Description

Title has an equals method, that implements equality based on the interwiki prefix, the namespace, and the title text, ignoring the page ID as well as any fragments.

With Title implementing both the LinkTarget interface as well as the PageIdentity interface, the question arises how equality should be defined.

For LinkTarget, it would be natural to define equality to be based on interwiki prefix, namespace and title text as before, but include the fragment as well.

For PageIdentity, it makes more sense to focus on the page ID (along with the wiki ID), and only rely on namespace and title text if the page doesn't exist (and thus the page ID is 0).

All three notions result in the same behavior in most cases, but have different behavior in notable edge cases.

In order to resolve this, LinkTarget and PageIdentity should define distinct methods for determining equality, separate from the equals() method implemented by Title: LinkTarget::isSameLink() and PageIdentity::isSamePage().

Related Objects

StatusSubtypeAssignedTask
Declineddchen
OpenNone
OpenNone
DuplicateNone
OpenNone
OpenNone
OpenNone
StalledNone
OpenNone
DuplicateNone
ResolvedNone
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedppelberg
ResolvedKrinkle
OpenNone
ResolvedNone
ResolvedNone
StalledNone
OpenNone
OpenNone
Opendaniel
OpenNone
OpenNone
OpenNone
OpenNone
Opendaniel
Opendaniel
Opendaniel
Resolveddaniel
Opendaniel
Resolveddaniel
ResolvedJdforrester-WMF
OpenPRODUCTION ERRORNone
Resolveddaniel
Resolveddaniel
Resolveddaniel

Event Timeline

daniel created this task.Jan 19 2021, 9:11 PM
Restricted Application removed a project: Patch-For-Review. · View Herald TranscriptJan 19 2021, 9:11 PM

Change 656948 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Define equality for PageIdentity and LinkTarget

https://gerrit.wikimedia.org/r/656948

daniel triaged this task as Medium priority.Jan 19 2021, 9:12 PM

Change 656948 merged by jenkins-bot:
[mediawiki/core@master] Define equality for PageIdentity and LinkTarget

https://gerrit.wikimedia.org/r/656948

Pchelolo closed this task as Resolved.Mon, Feb 1, 6:37 PM