예제 #1
0
def _send_feedback_thread_status_change_emails(recipient_list,
                                               feedback_message_reference,
                                               old_status, new_status,
                                               exploration_id, has_suggestion):
    """Notifies the given recipients about the status change.

    Args:
        recipient_list: list(str). A list of recipient ids.
        feedback_message_reference: FeedbackMessageReference. The reference to
            add to each email buffer.
        old_status: str. One of STATUS_CHOICES.
        new_status: str. One of STATUS_CHOICES.
        exploration_id: str. The id of the exploration that received a new
            message.
        has_suggestion: bool. Whether this thread has a related learner
            suggestion.
    """
    can_recipients_receive_email = email_manager.can_users_receive_thread_email(
        recipient_list, exploration_id, has_suggestion)
    for recipient_id, can_receive_email in python_utils.ZIP(
            recipient_list, can_recipients_receive_email):
        if can_receive_email:
            transaction_services.run_in_transaction(
                _enqueue_feedback_thread_status_change_email_task,
                recipient_id, feedback_message_reference, old_status,
                new_status)
예제 #2
0
def _send_instant_emails(recipient_list, feedback_message_reference,
                         exploration_id, has_suggestion):
    """Adds the given FeedbackMessageReference to each of the
    recipient's email buffers. The collected messages will be
    sent out immediately.

    Args:
        recipient_list: list of str. A list of user_ids of all
            recipients of the email.
        feedback_message_reference: FeedbackMessageReference.
        exploration_id: str. ID of exploration that received new message.
        has_suggestion: bool. Whether this thread has a related
            learner suggestion.
    """
    can_users_receive_email = (email_manager.can_users_receive_thread_email(
        recipient_list, exploration_id, has_suggestion))
    for index, recipient_id in enumerate(recipient_list):
        if can_users_receive_email[index]:
            transaction_services.run_in_transaction(
                enqueue_feedback_message_instant_email_task, recipient_id,
                feedback_message_reference)
예제 #3
0
def _send_instant_emails(recipient_list, feedback_message_reference,
                         exploration_id, has_suggestion):
    """Adds the given FeedbackMessageReference to each of the recipient's email
    buffers. The collected messages will be sent out immediately.

    Args:
        recipient_list: list(str). A list of user_ids of all recipients of the
            email.
        feedback_message_reference: FeedbackMessageReference. The reference to
            add to each email buffer.
        exploration_id: str. The id of exploration that received new message.
        has_suggestion: bool. Whether this thread has a related learner
            suggestion.
    """
    can_recipients_receive_email = email_manager.can_users_receive_thread_email(
        recipient_list, exploration_id, has_suggestion)
    for recipient_id, can_receive_email in python_utils.ZIP(
            recipient_list, can_recipients_receive_email):
        if can_receive_email:
            enqueue_feedback_message_instant_email_task_transactional(
                recipient_id, feedback_message_reference)
예제 #4
0
def _send_feedback_thread_status_change_emails(recipient_list,
                                               feedback_message_reference,
                                               old_status, new_status,
                                               exploration_id, has_suggestion):
    """Notifies the given recipients about the status change.

    Args:
        recipient_list: list of str. A list of recipient ids.
        feedback_message_reference: FeedbackMessageReference
        old_status: str, one of STATUS_CHOICES
        new_status: str, one of STATUS_CHOICES
        exploration_id: str. ID of exploration that received new message.
        has_suggestion: bool. Whether this thread has a related
            learner suggestion.
    """
    can_users_receive_email = (email_manager.can_users_receive_thread_email(
        recipient_list, exploration_id, has_suggestion))
    for index, recipient_id in enumerate(recipient_list):
        if can_users_receive_email[index]:
            transaction_services.run_in_transaction(
                _enqueue_feedback_thread_status_change_email_task,
                recipient_id, feedback_message_reference, old_status,
                new_status)
예제 #5
0
def _send_feedback_thread_status_change_emails(
        recipient_list, feedback_message_reference, old_status, new_status,
        exploration_id, has_suggestion):
    """Notifies the given recipients about the status change.

    Args:
        recipient_list: list of str. A list of recipient ids.
        feedback_message_reference: FeedbackMessageReference
        old_status: str, one of STATUS_CHOICES
        new_status: str, one of STATUS_CHOICES
        exploration_id: str. ID of exploration that received new message.
        has_suggestion: bool. Whether this thread has a related
            learner suggestion.
    """
    can_users_receive_email = (
        email_manager.can_users_receive_thread_email(
            recipient_list, exploration_id, has_suggestion))
    for index, recipient_id in enumerate(recipient_list):
        if can_users_receive_email[index]:
            transaction_services.run_in_transaction(
                _enqueue_feedback_thread_status_change_email_task,
                recipient_id, feedback_message_reference,
                old_status, new_status)
예제 #6
0
def _send_instant_emails(
        recipient_list, feedback_message_reference, exploration_id,
        has_suggestion):
    """Adds the given FeedbackMessageReference to each of the
    recipient's email buffers. The collected messages will be
    sent out immediately.

    Args:
        recipient_list: list of str. A list of user_ids of all
            recipients of the email.
        feedback_message_reference: FeedbackMessageReference.
        exploration_id: str. ID of exploration that received new message.
        has_suggestion: bool. Whether this thread has a related
            learner suggestion.
    """
    can_users_receive_email = (
        email_manager.can_users_receive_thread_email(
            recipient_list, exploration_id, has_suggestion))
    for index, recipient_id in enumerate(recipient_list):
        if can_users_receive_email[index]:
            transaction_services.run_in_transaction(
                enqueue_feedback_message_instant_email_task, recipient_id,
                feedback_message_reference)