ficlatte / main

Ficlatté website main code
GNU Affero General Public License v3.0
2 stars 2 forks source link

@Mentions #27

Open HSAR opened 7 years ago

HSAR commented 7 years ago

It would be nice to be able to mention people in comments. This should result in notifications going out into the activity feed and (optionally into email). The mention text itself should also turn into a link to the author's profile page.

See the mention for @ethel-t-frog , making use of GitHub's mentioning, for an example.

Notification might look like: "User1 mentioned you in the comments of Story1/Blog1."

This might mean having to do a certain amount of mapping usernames into user IDs.

EDIT: Being able to mention a story or blog post would be nice too.

stitzelj commented 7 years ago

That shouldn't be too difficult to implement, I would think. The mapping is basically already taken care of with the Profiles model. It's just a matter then of building the logic to transform the @mention into an active notification.

HSAR commented 7 years ago

My hesitation is that it means we'll have a hard time offering the ability to edit comments (since people will change their usernames, delete their accounts, etc.).

HSAR commented 7 years ago

Mentioning stories and blog posts would also be nice. Adding that to the original post.

stitzelj commented 7 years ago

@mentions are generally a more immediate need to get another user's attention quickly so they can reply in a timely manner. I don't really see that being an issue with a user who changes their username or deletes their account at some point down the road. That said, it should be easy enough to make the logic conditional on the backend to kill the link if the account mentioned is deleted or focus on the user id first and maybe even change the pen name to match if it changes, though that last part may be more work than it's worth.

HSAR commented 7 years ago

I disagree with your assertion about the purpose of mentions. I use them when I am clearly talking to someone in particular, but in a public discussion. See my current use of them, in Ficlatte comments.

https://ficlatte.com/blog/48/

It is possible that the "users change their account status" is a non-issue. After all, Ficly never allowed us to edit comments and we got along just fine, so having a one-time mapping when the comment is first posted seems simple, quick, and may be entirely fit-for-purpose.

stitzelj commented 7 years ago

Ah, well, I agree with you that they're useful for singling out individuals in a public discussion. I was more focused on the nature of the notification mechanism, I guess.

HSAR commented 7 years ago

Oh, sure. There less of a point of sending a notification that says "Your story was mentioned in the comments of XYZ by ABC", although I guess it could, optionally, be nice.

stitzelj commented 7 years ago

I like the idea of mentioning a story in a comment and having it turn into a link to said story, minus the notification, of course. Ideally, the slickest way to implement it would be to somehow prompt the comment editor on the fly that you're about to mention a story title and have it sort of do an auto-complete with possible titles as you type until you get to the one you want (sort of Google-style). That takes the burden off the user spelling the title correctly and not generating a link. I dunno... I need to noodle on the idea a bit.

HSAR commented 7 years ago

I can see two options: either that, which requires some fairly advanced bootstrap JS work, or just turn Ficlatte story urls into links (much, much simpler!).

stitzelj commented 7 years ago

That's a fair point. We'd want to limit link inclusion to just internal links to avoid spamminess, but I think that would be very easy to deal with on the backend.

ethel-t-frog commented 7 years ago

This feature sounds good to start with, but we must be wary of the potential for harassment. Other platforms have suffered abuse where a user can bombard another user with mentions, that send them e-mail linking back to a hateful story/comment. We should certainly allow a user to select whether they want to receive notifications as a global setting, and allow them to block other users.

HSAR commented 7 years ago

RE Administration: I don't feel it's necessary to spend dev time on the concern, at least at this stage. At our scale, case-by-base-handling bans should be perfectly workable.

stitzelj commented 7 years ago

I've done some research into this idea, and the major stumbling block I keep bumping into is the fact that we have a number of users that have multi-word pen names. I haven't decided if yet if there's a good, practical way to do mentions with this model. The best idea I've come up with so far is to do something similar to what Github does and the moment you type '@' plus the first letter of the user's pen name, it pops up a list of possibilities you can choose from. Even so, the raw text will have to add some kind of additional markup to encapsulate all the words of the pen name so that the whole thing can be translated into a profile link and user notification. So, there's going to be some work involved, and I haven't figured out the most ideal approach to that yet. I'm open to suggestions if you guys have any.

HSAR commented 7 years ago

Quote marks? @"I am a frog" isn't the best, but it would work.

stitzelj commented 7 years ago

Yeah, I was thinking that ideally having a jQuery/AJAX-powered pop-up (or the like) would be ideal for forcing the formatting so users don't have to remember the additional markup since it's different from what, Twitter, uses. Quotes seemed like the simplest and most straightforward markup to me, as well.

stitzelj commented 7 years ago

I have a partial solution in place for mentions at the moment. Basically, it's the selection dropdown when a user types '@' and the first couple letters of the user's pen name. I'm working now on the logic that passes the marked up code back to the submit_comment view so it can be translated into a link to the author profile and an email notification sent to the user about the mention. I'm having to learn a little jQuery on the fly here, so it's taking me a little longer to develop than I'd like. (The lack of sleep the last couple of days isn't really helping on that front, either.) I'll keep you posted on my progress, but I'm hoping to have a final working solution completed by the weekend.