How to comment @user?

I haven't found guidance on this question anywhere, which I supposed
would be a common one:

How can I go about creating a system where if I put the @symbol in front
of a user name in a comment that that user would receive a notification?

I have my MVC's for comments, notifications, and users.

Or if you think it would be easier to do it where when a user comments
on a post that every comment thereafter on that post would send him a
notification?

What do you think would be better/easier?

Do you any suggestions on how I can get started on this?

Thanks :slight_smile:

I haven't found guidance on this question anywhere, which I supposed
would be a common one:

How can I go about creating a system where if I put the @symbol in front
of a user name in a comment that that user would receive a notification?

I have my MVC's for comments, notifications, and users.

Or if you think it would be easier to do it where when a user comments
on a post that every comment thereafter on that post would send him a
notification?

You would need to parse the text, find the @user references and do the
notification. It may well be easier to implement your latter
suggestion, but I would have thought the important point is what the
users require. Neither seems particularly difficult.

Colin

What does @user contain? When you say in 'front of' do you mean to proceed as a word or to be concatenated?

Depending on the context, if you are building a string, eg, wrapped with " ", I find #{} really useful: "Some text #{@user(.prehapsSomeFieldValue)} and more user name comment".

Sending a Notification? Check how and what you are sending on .deliver (old: deliver_), presumably a model object, then check your notifier model. Then check your html.erb corresponding to the Notifier def name.

Liz

I think the OP was interested in recognizing the combination of the @ character and the user name or handle within a run of text, and parse it out of that as a "mention", so if someone put @emggurty2 in a reply to this list, you would get a "ping" of some sort.

Anthony, where would these @names appear, in what context?

Walter