def fire_to_listeners(parent_id, submitter, new_id, request):
    parent = general.find_by_id(parent_id)
    if isinstance(parent, Submission):
        submission = parent
    if isinstance(parent, Comment):
        submission = submission_queries.get_story_by_id(parent.submission_id)

    submitter = user_queries.get_user_by_id(submitter).display_name()

    users = get_users_to_notify(parent_id)
    for recipient in users:
        if 'users.id' in request.session and str(recipient.id) == request.session['users.id']:
            continue

        if recipient.notify_by_mail:
            send_mail(recipient, submitter, submission, new_id, request)

    return True
dataset/ETHPy150Open sjuxax/raggregate/raggregate/queries/notify.py/fire_to_listeners/original