☒ You could add it to the regular assets. I prefer to add any external sources to a separate place. You could put them in a vendor folder within the regular assets. Just having that bit of separation is nice because it's a reminder that we shouldn't ever manually change these files as upgrading to a newer version of the theme would "undo" our changes.
☒ Technically yes. However, since these permissions are highly derivative based on the application code, it doesn't make much sense to have it in the database. For example, if you add a new attribute to a user model, there will be a database change for sure, but also there will be application code change to consume this new attribute. It makes sense to keep the permission list with the code since that's where it is ultimately tied to.
☒ I would probably use the environment option which you can create a metatag on the layout with the Rails.env and fetch this to set it in the Sentry init. https://docs.sentry.io/platforms/javascript/configuration/options/#environment
☒ ruby object and instantiating it in the comment controller create action
def create
@comment = Comment.new(comment_params)
if @comment.save
CommentNotifier.call(@comment)
...
else
...
end
end
From there, you can make the Comment Notifier have guard clauses, do any checks and pass in any other additional parameters needed. (like passing in the current user to have a guard clause return unless current_user == comment.user) to prevent the current user getting a notification if they reply to their own comment.