Page MenuHomePhabricator

Make it clear in the visual mode comments will be automatically signed
Closed, ResolvedPublic

Description

This task is about making it more clear to people drafting a comment in the Reply tool's visual mode that their signature will automatically be added/included in the comments they post.

Situation

  • Experienced contributors writing a comment in the Reply tool's visual mode may not expect for the tool to automatically sign the comment they are drafting.
  • Accordingly, they may enter ~~~~ to sign the comment they are writing
  • Upon posting the comment they've just written, they notice their signature along with ~~~~ appears appended to the comment they just posted to the page.

Implementation details

The below describes how Approach #1 will function:
Scenario A

  1. When someone types ~~~~ in the Reply tool's visual mode at the end of their comment:
    • The ~~~~ will be transformed into the signature they have set for their account
    • A hit would be shown that says the following:*
      • TITLE: Signature markup detected.
      • BODY: ~~~~ has been transformed into your signature. To undo this, type + Z. Note: typing ~~~~ to sign your comments using this tool is not required; it will add your signature automatically.
  2. When someone saves this comment:
    • An additional signature will not be appended. Said another way: only one signature should appear.

Scenario B

  1. When someone types ~~~~ in the Reply tool's visual mode that is not at the end of their comment:
    • The ~~~~ will be transformed into the signature they have set for their account
    • The same "hint" described above will be shown.*
  2. When someone saves this comment:
    • An additional signature will not be appended. Said another way: only one two signatures should appear, the signature in the middle of this person's comment and the signature at the end of the person's comment.
    • A [ reply ] link should appear at the end of the comment, following the ending signature despite the person's signature appearing in the middle of it.

Reason for revision
As @Esanders identified when we talked about this today, if we do NOT adjust the software such that it appends signatures to comments signed in the middle, the comment parser will be less reliable because, in these cases [i], it will mistake one comment as being two.

*Notes about the "hint" implementation:

  • Frequency: the hint will be shown each time someone types ~~~~ in the Reply tool's visual mode.
  • Dismissal: the "hint" can be dismissed by clicking elsewhere in the Reply tool's text input or by pressing .
  • Location: the "hint" should be presented as it is shown here:

Open questions

  • 1. Approach #1: What happens when someone includes a signature in the middle of the comment they are writing?
    • The ~~~~ they typed will be transformed into a signature; the [ reply ] link will be appended to the end of their comment and no additional signature will be added. See: T255738#6257560
  • 2. Approach #1: How might someone write a comment like, ""You can sign your comments with ~~~~.
    • People can type + and the signature "transformation" will be undone. As a result, people will see ~~~~ in the tool's visual mode and <nowiki>~~~~</nowiki> in the tool's source mode. See: T255738#6262917.
  • 3. Approach #1:what can be done to preserve ~~~~ when someone types ~~~~ in the tool's visual mode, switches to source, switches back to visual and then back to source once more?
  • 4. What should the text inside the "hint" say?

Observed cases in production

Approaches

  • Approach #1: On pages where VE is enabled and signatures are allowed, typing ~~~~ will convert itself into a signature/selectable node.
  • Approach #2A: After a user types ~~~~, present a warning/instruction that informs them of two things: 1) the tool automatically signs comments and 2) if the ~~~~ they typed are left, they will be wrapped in <nowiki> tags when published.
    • Note: unless changed, the "warning/instruction" mentioned above would be presented in the same way edit warnings currently are.[1]
  • Approach #2B: Before a user types ~~~~, present a warning/instruction that informs them of two things: 1) the tool automatically signs comments and 2) if they do want to leave the ~~~~ in the comment they are writing, the tildes will be wrapped in <nowiki> tags when published.
    • Note: we did not talk about where/how this communication would be presented.

Notes

  1. Current edit warning treatment:


Reported by:

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

@matmarex: can you see a way of enhancing the in-progress patch for Approach #1 such that when someone types ~~~~ in the tool's visual mode, switches to source, switches back to visual and then back to source once more ~~~~ is preserved?

As this patch is currently implemented [i], I am experiencing the following:

  1. In the tool's visual mode, type: Thank you ~~~~.
  2. Observe ~~~~ is transformed into a signature such that the following is now shown: Thank you YOUR SIGNATURE
  3. Switch the tool's source mode, observe the following is shown, Thank you ~~~~
  4. Switch back to the tool's visual mode, observe the following is now shown: Thank you YOUR SIGNATURE

Actual

  1. ❗️Switch back to the tool's source mode, observe the following is shown: Thank you [[Special:Contributions/172.16.0.164|172.16.0.164]] 03:03, 29 June 2020 (UTC)

Expected

  1. ✅Switch the tool's source mode, observe the following is shown, Thank you ~~~~

i. I recognize 607091 is in progress.

Yeah, that can be fixed, I just updated the patch. It should work right if you create a new demo site.

ppelberg updated the task description. (Show Details)Jun 29 2020, 11:50 PM

Yeah, that can be fixed, I just updated the patch. It should work right if you create a new demo site.

Great. Thank you, Bartosz.

Confirmed: the latest demo works as expected [as described in T255738#6262919].

@matmarex, two follow up questions:

  1. Can you confirm when someone includes a signature in the middle of the comment they are writing [i], the tool will do the following?
    • Append a [ reply ] links to the end of the comment.
    • NOT append an additional signature at the end of the comment.
  1. Can you implement a hint [ii] whenever someone types ~~~~ into the tool's visual mode informing them the tool will automatically sign comments?
    • Provided I am understanding the question above correctly, I think we should move forward with Approach #1 with the addition of some way for people to be informed their comments will automatically be signed.[iii]
      • Trouble is, I wonder whether the ~~~~ ---> SIGNATURE transformation and hint [ii.] animation happening simultaneously will be distracting and/or overwhelming to people.

ii. Hint
Copy: TITLE: Signature markup detected. BODY: ~~~~ has been transformed into your signature. Note: typing ~~~~ to sign your comments is not required; the tool will do it for you automatically.

iii. Rationale

  • We assume, in most cases, Senior Contributors who type ~~~~ into the text input area are intending to sign their comment because it is habitual. As such, the tool should honor this behavior rather than force people to do something that is unnatural (read: not sign manually sign the comments they write).
  • It is important people be made aware the tool will automatically sign the comments they write so they can decide for themselves whether that is a feature they would like to take advantage of.
    • We are assuming the hint will be an effective way of "informing" people of the automatic signing functionality.

@matmarex, two follow up questions:

  1. Can you confirm when someone includes a signature in the middle of the comment they are writing [i], the tool will do the following?
    • Append a [ reply ] links to the end of the comment.
    • NOT append an additional signature at the end of the comment.

That's right.

  • Additional signature won't be added.
  • The [ reply ] link will be added at the end of the line (paragraph) containing the signature – as David pointed out above (T255738#6257560), this doesn't work great for multi-line comments. I'm not sure how we should try to handle this though.
  1. Can you implement a hint [ii] whenever someone types ~~~~ into the tool's visual mode informing them the tool will automatically sign comments?
    • Provided I am understanding the question above correctly, I think we should move forward with Approach #1 with the addition of some way for people to be informed their comments will automatically be signed.[iii]
      • Trouble is, I wonder whether the ~~~~ ---> SIGNATURE transformation and hint [ii.] animation happening simultaneously will be distracting and/or overwhelming to people.

I had another idea to display a hint without being distracting, we could put it into the signature context menu:


This would only appear if you click on the signature after it is generated – not sure if that's good or bad :)

@matmarex, two follow up questions:

  1. Can you confirm when someone includes a signature in the middle of the comment they are writing [i], the tool will do the following?
    • Append a [ reply ] links to the end of the comment.
    • NOT append an additional signature at the end of the comment.

That's right.

  • Additional signature won't be added.
  • The [ reply ] link will be added at the end of the line (paragraph) containing the signature – as David pointed out above (T255738#6257560), this doesn't work great for multi-line comments. I'm not sure how we should try to handle this though.

Good call. @DLynch / @matmarex, unless y'all can clearly see a way to fix this issue [i], I think we should leave it as unresolved for the time being.

Reasons:

  • We assume the majority of people who will interact with this approach (typing ~~~~ and having it transformed into a signature) will be Senior Contributors who will manually sign the comments they write out of habit.
  • We assume these "same" Senior Contributors are unlikely to sign the middle of a [multi-line] comment they write using full page editing
  • As such, I think we can assume Senior Contributors will be equally as unlikely to sign the middle of a [multi-line] comment they write using the Reply tool and as such do not need to design for this case.
  1. Can you implement a hint [ii] whenever someone types ~~~~ into the tool's visual mode informing them the tool will automatically sign comments?
    • Provided I am understanding the question above correctly, I think we should move forward with Approach #1 with the addition of some way for people to be informed their comments will automatically be signed.[iii]
      • Trouble is, I wonder whether the ~~~~ ---> SIGNATURE transformation and hint [ii.] animation happening simultaneously will be distracting and/or overwhelming to people.

I had another idea to display a hint without being distracting, we could put it into the signature context menu:


This would only appear if you click on the signature after it is generated – not sure if that's good or bad :)

Nice Bartosz. Per the conversation we had during today's standup, let's build off what you proposed and do the following:

  • When someone types ~~~~ in the Reply tool's visual mode:
    • The ~~~~ will be transformed into the signature they have set for their account
    • A hit would be shown that contains that says the following:
      • TITLE: Signature markup detected.
      • BODY: ~~~~ has been transformed into your signature. To undo this, type + Z. Note: typing ~~~~ to sign your comments using this tool is not required; it will add your signature automatically.
    • The hint will be shown each time someone types ~~~~ in the Reply tool's visual mode.

The above is also in the task description under the "Implementation details" section.


i. Multi-line comment
ppelberg updated the task description. (Show Details)Jul 1 2020, 12:55 AM
ppelberg updated the task description. (Show Details)
ppelberg updated the task description. (Show Details)

Proposed changes:

BODY: ~~~~ has been transformed into your signature. If you meant to have ~~~~ appear in your comment you can press undo. Note that you don't need to sign comments made using this tool as it will add your signature automatically.

Proposed changes:

BODY: ~~~~ has been transformed into your signature. If you meant to have ~~~~ appear in your comment you can press undo. Note that you don't need to sign comments made using this tool as it will add your signature automatically.

Looks good to me.

@matmarex moving this to ready for development so you can pick it up.

Also this task shouldn't be closed unless it has design review from @iamjessklein

Change 607091 had a related patch set uploaded (by Esanders; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] [WIP] Detecting typed signatures in visual mode

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/ /607091

Also this task shouldn't be closed unless it has design review from @iamjessklein

Adding Editing Design per Jazmin's comment above.

I don't think this happens very often "in the wild". NicoV has very kindly been keeping an eye out for this on frwiki, where the Reply tool has been used quite a lot, and he has found zero instances so far.

@Whatamidoing-WMF So it just occurred to me that the reason I might have done this is because I use reply link on enwiki which has a similar interface so I'm used to signing. I don't know if that is a widely used enough script to make development decisions around that, assuming that is the reason I did it, or if I'm just an unrepresentative sample.

@ppelberg I couldn't find this anywhere, so please remind me: we decided to go with the "floating" hint (like the current wikitext warning), and not a hint in the context menu, correct?

From @ppelberg : @matmarex we decided to go with the latter: A hint in the context menu.

From @ppelberg : @matmarex we decided to go with the latter: A hint in the context menu.

Thanks, OK.

This part of an earlier comment was suggesting the opposite for me:

  • When someone types ~~~~ in the Reply tool's visual mode:
    • (…)
    • The hint will be shown each time someone types ~~~~ in the Reply tool's visual mode.

With the context menu, the hint isn't shown immediately (until you select the signature) – but I suppose we can simply select the signature node automatically to achieve it.

From @ppelberg : @matmarex we decided to go with the latter: A hint in the context menu.

Thanks, OK.

This part of an earlier comment was suggesting the opposite for me:

Ah, that makes sense. I'm also realizing that I did not specify/define within the task description's "Implementation details" section what exactly I meant by "Hint."

All to say: I'll take additional care next time to resolve any ambiguity. In the meantime, the task description is updated.

With the context menu, the hint isn't shown immediately (until you select the signature)...

Roger that.

I suppose we can simply select the signature node automatically to achieve it.

Let's try this and see how it feels.

Esanders assigned this task to matmarex.Jul 15 2020, 3:55 PM

Change 612984 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Signature handling in visual mode

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

This is ready for review now, there are two patches now since the changes got too big for my liking:

The copy in the patch is as follows:
"~~~~ has been transformed into your signature. To undo this, type Ctrl+Z. Note: typing ~~~~ to sign your comments using this tool is not required; it will add your signature automatically."

nb "Ctrl+Z" is dynamically generated so will be correct on Macs too

Thinking about this I think we should put the most useful information upfront, so:

  1. What just happened ("~~~~ has been transformed...")
  2. You probably don't want to do this, so how to "fix" this, i.e. you can delete this
  3. In the rare case you wanted to type "~~~~", how to "fix" for, i.e. press ctrl+z

I therefore suggest something like:

"~~~~ has been transformed into your signature.
This tool will add your signature automatically to your comments so this signature can be deleted.
If you meant to have ~~~~ appear in your comment you can press Ctrl+Z."

I suppose we can simply select the signature node automatically to achieve it.

Let's try this and see how it feels.

The signature automatically being selected feels good [i]...nice work, Bartosz.


i. http://patchdemo.wmflabs.org/wikis/42301482c9b2d1b03fc0d89897735a70/w/index.php/Talk:Main_Page

On hint copy...

Thinking about this I think we should put the most useful information upfront, so:

  1. What just happened ("~~~~ has been transformed...")

Agreed.

  1. You probably don't want to do this, so how to "fix" this, i.e. you can delete this

@Esanders, can you say more here? What are you thinking this person didn't want to happen?

...I think the person typing ~~~~ does want their signature to appear. So, suggesting they delete their signature seems to be in conflict with what they are intending.

The above is not to say people shouldn't be made aware the tool can save them some time [by automatically signing their comments]. Rather that I think people will be most apt to "hear" the "you don't have to sign you comment" part if it is framed as a "reminder for next time" kind of thing, not as a "you did something wrong" kind of thing.

It's with the above in mind that I think we should continue to use the copy you proposed here:

Proposed changes:

BODY: ~~~~ has been transformed into your signature. If you meant to have ~~~~ appear in your comment you can press undo. Note that you don't need to sign comments made using this tool as it will add your signature automatically.

@iamjessklein I am cc'ing you here in case you have things to add about the copy that is presented when people type ~~~~ in the Reply tool's visual mode. You can see what is currently shown in the Patch demo linked below [i] and the revisions that are being proposed here: T255738#6312313.


i. http://patchdemo.wmflabs.org/wikis/42301482c9b2d1b03fc0d89897735a70/w/index.php/Talk:Main_Page

...I think the person typing ~~~~ does want their signature to appear. So, suggesting they delete their signature seems to be in conflict with what they are intending.

99% of the time they want a signature at the end of their comment, so the signature is unnecessary. By telling them they can delete it we are explicitly stating that *this* node is the one that has been made redundant by the auto-sign functionality.

ppelberg updated the task description. (Show Details)Jul 20 2020, 11:52 PM

Revisions to implementation

Scenario B should be revised to function as follows:

  1. When someone saves this comment:
    • An additional signature will not be appended. Said another way: only one two signatures should appear, the signature in the middle of this person's comment and the signature at the end of the person's comment.
    • A [ reply ] link should appear at the end of the comment, following the ending signature despite the person's signature appearing in the middle of it.

Reason for revision
As @Esanders identified when we talked about this today, if we do NOT adjust the software such that it appends signatures to comments signed in the middle, the comment parser will be less reliable because, in these cases [i], it will mistake one comment as being two.

The task description has been updated to reflect the change in approach


Next steps

  • Adjust implementation so it behaves as is described in the "Implementation details > Scenario B" of the task descritpion.

i. Hello my name is ~~~~. Nice to meet you

Have we decided on any wording changes for the hint?

I think I prefer Peter's original version, I don't really want to suggest deleting the signature.

Change 612984 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Signature handling in visual mode

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

Change 607091 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Improve detecting typed signatures

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

Have we decided on any wording changes for the hint?

...I don't really want to suggest deleting the signature.

+1. Let's use the below:

TITLE
Signature markup detected

BODY
~~~~ has been transformed into your signature. To undo this, type {key command} + {key Z}. Note that you don't need to sign comments with this tool, your signature will be added automatically.


@matmarex: just updated the copy one last time after @iamjessklein wisely suggested we try to shorten the copy a bit which we've done and is reflected above.

The text Note that you don't need to sign comments with this tool, your signature will be added automatically. is a https://en.wikipedia.org/wiki/Comma_splice It needs to be split into two sentences:

Note that you don't need to sign comments with this tool. Your signature will be added automatically.

Change 615538 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Tweak wording of the visual mode signature hint

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

Change 615538 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Tweak wording of the visual mode signature hint

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

ppelberg moved this task from Inbox to Low Priority on the Editing QA board.Jul 23 2020, 9:22 PM
Ryasmeen added a subscriber: Ryasmeen.

Scenario B has failed: because there are two reply links appearing, instead of one. One in the middle of the comment another at the end of the comment as if they are treated as two separate comments.

@Ryasmeen Thanks. It turns out that we forgot about multi-line comments. This works as we wanted when the comment with the extra signature has only one line, but when you make a multi-line comment (and the extra signature isn't on the last line), it will have an extra "reply" link.

For future reference, I tested this on the page https://en.wikipedia.beta.wmflabs.org/wiki/Talk:T255738:

Single line comment
Multi-line comment

I'm not sure if this is a big problem. It's a little funky, but the extra reply links are harmless and work as expected, so maybe it's fine?

@ppelberg Do you think we should change this behavior? FWIW, it shouldn't be too difficult to do that.

ppelberg added a comment.EditedAug 7 2020, 11:17 PM

@Ryasmeen Thanks.

+1; good spot, Rummana.

It turns out that we forgot about multi-line comments. This works as we wanted when the comment with the extra signature has only one line, but when you make a multi-line comment (and the extra signature isn't on the last line), it will have an extra "reply" link.
I'm not sure if this is a big problem. It's a little funky, but the extra reply links are harmless and work as expected, so maybe it's fine?

@ppelberg Do you think we should change this behavior? FWIW, it shouldn't be too difficult to do that.

Let's fix it. While I think the likelihood of this issue occurring is quite low, in the cases it does, I think one comment being represented on the page as two will confuse people reading the conversation.

To confirm, @matmarex is the "Desired behavior" below what you had in mind?

Desired behavior

  1. When someone types some text (e.g. hello) and then types ~~~~ in the Reply tool's visual mode:
    • The ~~~~ will be transformed into the signature they have set for their account
    • The same "hint" described in the task description will be shown.
  2. Presses enter
  3. Types some more text (e.g. goodbye)
  4. Publishes the comment they wrote in Steps 1-3
    • A single [ reply ] link should appear at the end of the comment, following the ending signature

I don't think it's possible to distinguish between a multi-line comment that has been signed twice and two adjacent comments made in the same minute:

: Signatures look like this: --Ed 2020-08-11 12:58
: ...hope that helps! --Ed 2020-08-11 12:58
: I agree. --Ed 2020-08-11 12:58
: To be more specific, I think this is the correct approach. --Ed 2020-08-11 12:58

Indeed it isn't. I don't think it really matters how we handle that case. But when we have to choose between rare unexpected behavior for comments posted using the reply tool, and rare unexpected behavior for some other comments, I think it's better to fix the first.

Change 619549 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] More test cases for multiple signatures in funny places

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

Change 619550 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Merge multi-line comments with multiple signatures

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

Change 619551 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Skip to the end of the paragraph in the parser, not modifier

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

I'm not sure it's worth adding a bunch of complexity for an edge case we've never seen, so we don't know which interpretation is more likely.

Change 619549 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] More test cases for multiple signatures in funny places

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

I'm not sure it's worth adding a bunch of complexity for an edge case we've never seen, so we don't know which interpretation is more likely.

Most of the complex changes in my patches actually turned out to also be needed to fix T260855, which I think we need to do. Dropping the code to merge multiline comments doesn't really save us much (basically, it's the big if statement here: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/619550/4/includes/CommentParser.php).

That said I'd be fine with leaving it in the current state as well, and giving up on the merging, I don't think it really matters because it's so rare.

@ppelberg Thoughts?

That said I'd be fine with leaving it in the current state as well, and giving up on the merging, I don't think it really matters because it's so rare.

@ppelberg Thoughts?

I'm walking back what I shared in T255738#6370195: let's leave the behavior as-is. Read: let's not add the additional handling for the case Ed described in T255738#6375764.

If we receive reports and/or notice Reply links appearing in places where they shouldn't, we can revise this approach.

Resulting question

  • Does the above mean this task is "Ready for sign off"?

Resulting question

  • Does the above mean this task is "Ready for sign off"?

Yeah, I think we're done here.

Change 619550 abandoned by Bartosz Dziewoński:
[mediawiki/extensions/DiscussionTools@master] Merge multi-line comments with multiple signatures

Reason:
As discussed on the task, we don't want to make this change after all.

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

ppelberg closed this task as Resolved.Sat, Sep 5, 1:13 AM
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptSat, Sep 5, 1:13 AM