lml/commontator

Add support for "@<username>" mentions

Closed this issue · 2 comments

When a comment is created, and one or more "@" mentions (something like /\A[@][a-zA-Z]+\z/) run the specified lambda passing commontable instance (post, page, etc), comment, array of "@" mentions.

config.mention_proc = lambda { |thread, comment, mentions| mentions.each { u = User.find(mention); u.notify(comment) if u; }  }

^ roughly like that or something that allows the user to be notified

And add relevant potion to initializer:

  # thread_subscription
  # Type: Symbol
  # Whether users can subscribe to threads to receive activity email notifications
  # Valid options:
  #   :n (no subscriptions)
  #   :a (automatically subscribe when you comment; cannot do it manually)
  #   :m (manual subscriptions only)
  #   :i (@<user> mention, single notification) # new option
  #   :t (@<user> mention, subscribe to thread from now on) # new option
  #   :b (both automatic, when commenting, and manual)
  # Default: :n

Hi @cartrdgetech there is already a pull request for mentioning users. Feel free to contribute to it: #70

All done and merged. Will release after some more testing.