known icon indicating copy to clipboard operation
known copied to clipboard

Better support for @-mentions across platforms.

Open cleverdevil opened this issue 7 years ago • 6 comments

With the advent of Micro.blog, I'm starting to run into issues with how Known implements @-mentions and "replies." I'd love some direction on the best way to handle it. For reference, here is Micro.blog's instruction on how to @-mention and reply from an externally hosted site.

In my ideal world, when I @-mention someone in a Status/Reply, I'd like the ability to specify the target that I am mentioning with a link, as Micro.blog suggests. The issue is that, as far as I can tell, Status and Reply objects only support plain-text content, not HTML content.

Again, I'd love @mapkyca and @benwerd to chime in here with some directional feedback, if and when they have time. I know you're both busy, so no rush! But, given some direction, I can work on a pull request to support this use case.

(Related: I'd like to eventually implement shortcuts for @-mentioning Twitter, Micro.blog, and the broader IndieWeb).

cleverdevil avatar Feb 04 '18 19:02 cleverdevil

@cleverdevil talking to @eddie and @aaronpk about this in terms of of "nickname database" this might be related ro @mapkyca following work he did on the earlier exploration of reader subscription.

The general idea in my mind is I publish a follow post type -u-follow-of to someone's homepage. If an h-card exist on the homepage any u-url is parsed and the nickname database populated.

Then depending on how I syndicate, if I @ mention @cleverdevil but your are different nick on micro.blog the correct link will be sent in syndication.

jgmac1106 avatar Oct 17 '18 00:10 jgmac1106

So, as @benwerd and @mapkyca think about how to implement this, I've gone ahead and done some tinkering and implemented a little service in my CleverCustomize plugin (not committed to the official repo yet) that could potentially help improve @-mentions across services:

https://gist.github.com/cleverdevil/17a5cea3cb8d81c43404de169720a8df

You can try it out here:

https://cleverdevil.io/nicknames?url=https://werd.io

The idea is that a user in Known could compose an @-mention using a domain name, and Known would then properly transform that @-mention based upon how that content is being syndicated. For example, if I published the following note:

Hey @{werd.io}, how are things going?

... my service would look up @benwerd's h-card and rel=me links from his website, and then return the following:

[
    {
        "type": "twitter",
        "username": "benwerd",
        "url": "http://twitter.com/benwerd",
        "mention": {
            "html": "<a href=\"https://twitter.com/benwerd\">Ben Werdmüller</a>",
            "text": "@benwerd"
        }
    },
    {
        "type": "github",
        "username": "benwerd",
        "url": "https://github.com/benwerd",
        "mention": {
            "html": "<a href=\"https://github.com/benwerd\">Ben Werdmüller</a>",
            "text": "@benwerd"
        }
    },
    {
        "type": "linkedin",
        "username": "benwerd",
        "url": "http://www.linkedin.com/in/benwerd",
        "mention": {
            "html": "<a href=\"https://www.linkedin.com/in/benwerd\">Ben Werdmüller</a>",
            "text": "@benwerd"
        }
    },
    {
        "type": "instagram",
        "username": "ben.werdmuller",
        "url": "https://instagram.com/ben.werdmuller",
        "mention": {
            "html": "<a href=\"https://instagram.com/ben.werdmuller\">Ben Werdmüller</a>",
            "text": "@ben.werdmuller"
        }
    }
]

If I toggled syndication to Twitter on the post, the syndicated version would automatically transform to Ben's Twitter username to properly mention him on that particular silo. Similarly, if I syndicated to Micro.blog, I could theoretically mention Ben on that service if he had a username there. If he didn't have a username, Known could simply transform into a hyperlink (<a href="https://werd.io"> Ben Werdmüller</a>).

Eventually, it'd also be nice for Known to have a sort of contacts database with nicknames/petnames for people ("Mom," "Dad," "Lacey," "Ben," etc.) that would be used instead of the parsed h-card's name property.

cleverdevil avatar Nov 02 '18 18:11 cleverdevil

Hi, just swinging back to this. I'd be keen to look at any PRs.

Some notes and thoughts:

  • Mention.js is currently disabled, not sure why (perhaps @benwerd can supply context), but as of time of writing it's a deletion candidate (#2364) because it's been disabled for so long.
  • The @-mention js points to a search endpoint, so it'd make sense to reuse this somehow
  • The nicknames db should also probably handle local users too (perhaps this could be handled between the difference between @mapkyca and @{mapkyca.com} )
  • The friend/follow stuff is still there, but has probably suffered some bitrot. If we're going to reuse this it'd make sense to reuse some of the parsing / follow stuff and bring it into a nicer workflow. So far you can follow a url (which works off a bookmarklet - obviously needs to be done better), and then MF2 is parsed, with a UI to allow you to edit and fill in any blanks. Crucially, the UX is a bit clunky, and we need to do a "proper" engineering job on it - i.e. make the code reusable and not have it stuck in the action endpoint.
  • Crucially, the friend/follow stuff works off the concept of a RemoteUser, which is an entity that already exists. So, it would make sense if this was reused.

Like I said, I would love to look at PRs for this, especially if it means dusting off some of the friend follow stuff. This has always been on my "copious amounts of free time" list, but I've never had a chance to get to it.

mapkyca avatar Mar 23 '19 10:03 mapkyca

Another upvote for this. When you gateway to both twitter and mastodon it gets confusing which @ handle you're referring to.

Even just supporting @[email protected] etc would be an improvement.

lindner avatar Apr 17 '19 16:04 lindner

Id be tempted to add a hook to the search endpoint for this and let service plugins (twitter, etc) handle this and extend the search results.

I could at least look at that, but I'm not sure I'd get much further than this... like I said, PRs welcome!

mapkyca avatar Apr 17 '19 16:04 mapkyca

This would be superb. Might actually get me to switch away from Wordpress if I can find an easier method of doing things. At the moment, it's impossible at best!

Cambridgeport90 avatar Dec 07 '19 18:12 Cambridgeport90