Page MenuHomePhabricator

Link task number and title for easier referencing via copy & paste
Closed, WontfixPublic

Description

Linking to a task would be streamlined if the title and task number breadcrumb were both linking to the task URL. This would allow copy / pasting either the title or task number as a linked HTML fragment, which is useful when working with HTML editors, Google docs and a variety of tools consuming HTML.

Event Timeline

@chad, you may have thoughts on this or remember related product stuff better than I do.

I believe it is intentional that we don't link the crumb to make it easier to copy-paste just the "object monogram" (like T123) as plain text. In particular, because it is plain text, you can double-click it to select it. If it was a link, you could not do this.

Copying just the text of the link is particularly useful inside Phabricator (because many interfaces and UIs know how to handle it), while copying a rich version of it is not as useful (because we don't use HTML-based editing). Copying a rich version is also inherently slower, because you can't double-click. I don't know how common double-click-to-select is, but I know we've consistently seen complaints about it when we accidentally break it (D6026/T2319, for example).

So I think the plain-text link and HTML-text link compete with one another directly. Given this, favoring referential convenience within Phabricator seems preferable to favoring referential convenience in Google Docs, so I tend to think that unlinked text is the right product choice.

(I also think there was at least one report, some time ago, of someone being confused that a page had a link to itself? I don't really remember and that's also silly, but maybe there was more to it and I'm just trivializing it in hindsight.)

Oh, and D15263 was specifically to improve double-click behavior, although that was just me rather than external users (I double-click to select frequently).

Yeah, our thoughts are that full URL is easily available in your browser bar, and monogram is easily available in the crumbs. I use both. Is there a scenario where the browser URL bar doesn't work for you?

I think the scenario is:

  • If you copy-paste the URL into Google Docs, you get something that looks like this in your doc (a full URL as the display content for the link): https://secure.phabricator.com/T12043
  • If you copy a full link from an HTML page, Google Docs will accept the full link and render something that looks like this (just the monogram as the display content for the link): T12043

The second one is a little more readable than the first one.

I frequently link to phabricator tasks on wiki pages or in google docs. The current workflow to get a linked task number or title is rather cumbersome:

  • Copy title or task number
  • Paste into target editor / doc
  • Go back to phabricator tab, copy URL
  • Go back to target editor / doc, select title or task number, add link from clipboard

With linked titles / breadcrumbs, this would be simplified to:

  • Copy task number or title
  • Paste into target editor / doc.

With a plain text paste target (ex: phabricator), just the tag number or -title is pasted, so the behavior remains the same.

So really, the only downside would be the loss of double-click selection. I personally don't use double click as I expect titles / breadcrumbs to be linked, but obviously expectations in that regard differ.

Perhaps an alternative would be to provide a linked task number *and* title somewhere else in a task view (example: T12345 - Foo in Bar is broken)? Having both the task number and title in the link text would be even better in most use cases, and it is very quick to delete the task number or title to get only one part of the link text.

It's not a big deal for me since I use Chrome to re-link the crumb. It's two clicks in the URL bar, or two clicks in the crumbs. But I think Safari it's 3 clicks...

Or if it's helpful, I could link something else like the header/title.

One vague idea is that it may be possible to use a Google Docs plugin. The "Google Apps Script" development environment was a bit of a test in patience the last time I used it, but basically you can write "Add-Ons" and publish them to the "Google Apps Store", and then users can install them. This is sort of the starting point:

https://developers.google.com/apps-script/quickstart/docs

That is, I think the best possible behavior would be for Google Docs to automatically enrich Phabricator links when you paste them into a document, similar to how we automatically enrich T123 (and, after T5378, the full version of such links). I'm not sure if it's possible to write such an integration, but if it were I think it would be a cleaner fix, and it could possibly do other things (like provide hovercards inside the Docs document).

That said, a cursory inspection suggests that there's no way to react to an edit in a Docs document, nor to install UI triggers for things like mouseover. I think we could easily add a menu item like "Beautify all task links in this document" which would go through the whole document and perform an edit, but it doesn't look like there's a way to build something more interactive.

(Even if it was possible, I think this would be about a century years away on our upstream priority list, especially given my previous experience with Apps plugins.)

A similar but narrower approach might be a browser plugin that intercepts pastes and rewrites Phabricator URLs into rich content? I'm not sure if that's really possible either, though, and browser plugins are a many centuries away on our priority list.

@epriestley: Plain HTML copy / paste works with most WYSIWYG editors, both online and offline. It is also a lot more discoverable, as people are used to it just working.

epriestley claimed this task.
epriestley added a subscriber: 20after4.

Concretely, since this is presumably about the WMF install and you already maintain patches, this is the one-line edit required to make the change you're asking for:

diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
index f1157bcb9..ab857fc8c 100644
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -60,7 +60,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
 
     $monogram = $task->getMonogram();
     $crumbs = $this->buildApplicationCrumbs()
-      ->addTextCrumb($monogram)
+      ->addTextCrumb($monogram, $task->getURI())
       ->setBorder(true);
 
     $header = $this->buildHeaderView($task);

Convincing or bribing @20after4 to merge and maintain that is probably the shortest path forward here. That patch is broadly a reasonable sort of patch and very unlikely to cause issues or merge conflicts -- the only issue is that it only affects tasks, not other object types, so it will make the behavior slightly inconsistent. And it will break double-click-to-select.

It's hard for me to concretely evaluate the value of paste-into-Docs vs double-click-to-copy since we don't really have much data to support the value of either approach, but we've seen more feedback about double-click-to-select and I think paste-into-Docs is, at least, not dramatically more useful or valuable than double-click-to-seelct, so I think we should keep the current behavior, at least for now. We'll keep an eye out for other users who are interested in this.

Purely for reference, here's the behavior of other software, as best as I was able to determine just now:

SoftwareHTML Self Link?
Trello No
JIRA Yes
GitHub Issues No
GitLab Issues No
Bugzilla Yes
Asana No
Trac Yes

While we wouldn't necessarily implement this even if every other task system did, I do think the uneven support in other systems serves as a reasonable sanity check that this probably isn't widely considered to be a critical feature.

Concretely, since this is presumably about the WMF install and you already maintain patches, this is the one-line edit required to make the change you're asking for:

This would only link the task number, which is typically less useful than the task title. Ideal would be a linked task number and title.

This will link both:

diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
index f1157bcb9..02314996d 100644
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -60,7 +60,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
 
     $monogram = $task->getMonogram();
     $crumbs = $this->buildApplicationCrumbs()
-      ->addTextCrumb($monogram)
+      ->addTextCrumb($monogram, $task->getURI())
       ->setBorder(true);
 
     $header = $this->buildHeaderView($task);
@@ -210,6 +210,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
     $view = id(new PHUIHeaderView())
       ->setHeader($task->getTitle())
       ->setUser($this->getRequest()->getUser())
+      ->setHref($task->getURI())
       ->setPolicyObject($task);
 
     $priority_name = ManiphestTaskPriority::getTaskPriorityName(

When I try to select both and copy them I get "number, newline, space name, vertical bar, title". Maybe you only plan to copy them separately? Or you could try this instead, to repeat the monogram in the title:

diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
index f1157bcb9..32aa6e18f 100644
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -60,7 +60,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
 
     $monogram = $task->getMonogram();
     $crumbs = $this->buildApplicationCrumbs()
-      ->addTextCrumb($monogram)
+      ->addTextCrumb($monogram, $task->getURI())
       ->setBorder(true);
 
     $header = $this->buildHeaderView($task);
@@ -208,8 +208,9 @@ final class ManiphestTaskDetailController extends ManiphestController {
 
   private function buildHeaderView(ManiphestTask $task) {
     $view = id(new PHUIHeaderView())
-      ->setHeader($task->getTitle())
+      ->setHeader($task->getMonogram().' '.$task->getTitle())
       ->setUser($this->getRequest()->getUser())
+      ->setHref($task->getURI())
       ->setPolicyObject($task);
 
     $priority_name = ManiphestTaskPriority::getTaskPriorityName(

@epriestley, thanks for the examples. The second variant would offer the best ergonomics for copy / pasting, but of course it would also change the rendering of the heading.

Yes. I think we had a similar element at some point, but removed it in a design update some time ago because it felt visually busy/redundant, particularly across other object types. If you do a lot of copy/pasting into Google Docs, the utility might overwhelm the visual repetition, though.

You could also link only the title and leave the breadcrumb for double-click-selection if you have internal users in both camps, although then you'd no longer have the option to select the short-form HTML link.

Finally, you could write a PHUICurtainExtension that put a little panel of copy-pasteable links into the right sidebar, beneath "Authored By". This could conceivably offer copy/paste-able links in various forms (short/medium/long, or with extra formatting or punctuation), perhaps with extra padding to create larger targets for clicking more easily.