This task involves the work with defining what people will experience when the software cannot be certain where the comment people are looking for is located. //See the `===Cases` below for the list of scenarios in which people might encounter this scenario.//
=== Stories
- **As someone** who is trying to view a comment that the software cannot confidently locate and take me to, **I want to** know that the software cannot locate the comment I am seeking, why it cannot locate said comment, and where I might look to find said comment, **so that** I can: **A)** increase the chances that I can find the comment I'm seeking myself and **B)** form more accurate expectations for what the comment linking feature is and is not capable of.
=== Requirements
# When someone arrives to a page after clicking/tapping a permalink and one of the following [three things happens](https://www.mediawiki.org/wiki/Extension:DiscussionTools/How_it_works#Permanent_links) (see below); they ought to see a toast-like dialog
## The comment cannot be found
### Comment exists, but we can't find it. //E.g. it didn't get indexed via T315510//
### Comment never existed. //E.g. the commentID is corrupted or otherwise invalid.//
## The comment might be visible in more than one place
# The "toast-like dialog" "1." describes ought to:
## Inform people which case (A, B, or C) they're experiencing
## Present people with action(s) they can take to locate the comment the software has not able to confidently locate
## Show a maximum of !!YET-TO-BE-DETERMINED NUMBER!! of potential pages on which the comment you're seeking could exist. In cases where the number of potential pages exceeds said "yet-to-be-determined-number" of pages people ought to see a call to action that invites them to visit `Special:FindComment` to see all results.
=== Mockups
=== Prototype
https://patchdemo.wmflabs.org/wikis/5ee978883e/wiki/Talk:Empty#c-Jts1882-2021-10-19T14:32:00.000Z-Medelam-2021-10-19T13:49:00.000Z
=== Open Questions
- [x] 1. What are all of the cases we need to consider as part of this task?
-- //See T304579#8097154.//
- [x] 2. How might someone generate a link to a comment before the permanent links feature gets deployed?
-- This was made possible by way of https://meta.wikimedia.org/w/index.php?title=User:ESanders_(WMF)/commentlinks.js
- [x] 3. What would be involved with back-filling the data for older comments?
-- See: T315510
- [ ] 4. How we show a "topic not found" message if a plain fragment (T349653) doesn't match an archived section?
-- //Note that fragments are used by other apps, e.g. "#/media/File:.." so although we try to filter out known patterns, we may end up searching for "headings" that aren't actually fragments for another purpose, e.g. #myApp-isOpen. Displaying a "topic not found" message in these cases could be confusing.//
--- //Conversely, not showing anything when the user follows a link to a thread that was deleted (not archived) could be confusing, when the equivalent DT permalinks do show "not found" messages.//
--- //Actual examples of gadgets setting the hash fragment to something other than a section title: https://global-search.toolforge.org/?q=location%5C.hash+*%5C%3D+*%5B%22%27%5D%5B%5E%22%27%5D®ex=1&namespaces=2%2C4%2C8&title=%28Gadgets-definition%7C.*%5C.%28js%7Ccss%7Cjson%29%29 .//
=== Done
- [ ] Answers to all `Open questions` are documented
- [ ] `Requirements` are documented
- [ ] `Mockups` are added and implemented
---
=== Cases
//This section contains the list of cases we will need to design the user experience for; it is borrowed from what @matmarex has documented on mediawiki.org: [Extension:DiscussionTools/How_it_works#Permanent_links](https://www.mediawiki.org/wiki/Extension:DiscussionTools/How_it_works#Permanent_links).//
**Case #1: the comment //might// not visible anywhere**
- //Potential reasons://
-- The comment being linked to never existed in the first place, and the link is wrong
-- The comment being linked to has been removed from the page (removing comments outright is rare, but occasionally done for off-topic, redundant or offensive comments)
-- The comment being linked to has been edited in a way that breaks our identification (e.g. deleting and re-adding a signature)
-- The comment being linked to was supposed to be archived/moved by cut-and-paste, but something went wrong with the second half of the operation and it was just deleted
-- The [discussion item database](https://www.mediawiki.org/wiki/Extension:DiscussionTools/How_it_works#Discussion_item_database) hasn't been populated for that page.
**Case #2: the comment //might// be visible in more than one place**
- //Potential reasons://
-- The comment being linked to is actually two indistinguishable comments on different pages (read: two comments with the same author, date and time)
-- The comment being linked to was supposed to be archived/moved by cut-and-paste, but something went wrong with the first half of the operation and it was just copied
-- The comment being linked to might be transcluded on multiple pages (we ignore transclusions when looking for the redirect target, so this doesn't lead to the scenario below)
**Case #3: the comment //might// be older than the permalinks feature**
//The feature only has data about comments added after it has been deployed.//