<commit_before>from django.conf import settings


def get_connect_url(marketplace_request, request_user):
    """
    Connecting user with Org Admin/First Learner via NodeBB Chat
        1: If Organization admin is not present then connect with the first learner.
        2: If Organization(orphan organization) admin and first learner both are
           not present then connect user with the marketplace request creator.
        3: In case of requester is the admin/first learner of organization
           button should be grayed out and disabled.
    :param marketplace_request: marketplace request item
    :param request_user: request user object
    """
    chat_url = '{nodebb_end_point}/chat/{username}'
    responsible_user = marketplace_request.organization.admin or marketplace_request.organization.first_learner \
                       or marketplace_request.user
    if responsible_user.username != request_user.username:
        connect_url = chat_url.format(nodebb_end_point=settings.NODEBB_ENDPOINT, username=responsible_user.username)
    else:
        connect_url = None

    return connect_url<commit_msg>added get_connect_url in helpers and changed the connect_url login<commit_after>from django.conf import settings


def get_connect_url(marketplace_request, request_user):
    """
    Connecting user with Org Admin/First Learner via NodeBB Chat
        1: If Organization admin is not present then connect with the first learner.
        2: If Organization(orphan organization) admin and first learner both are
           not present then connect user with the marketplace request creator.
        3: In case of requester is the admin/first learner of organization
           button should be grayed out and disabled.
    :param marketplace_request: marketplace request item
    :param request_user: request user object
    """
    chat_url_formatter = '{nodebb_end_point}/chat/{username}'
    responsible_user = marketplace_request.organization.admin or marketplace_request.organization.first_learner \
                       or marketplace_request.user
    if responsible_user.username != request_user.username:
        connect_url = chat_url_formatter.format(nodebb_end_point=settings.NODEBB_ENDPOINT, username=responsible_user.username)
    else:
        connect_url = None

    return connect_url
{'fraction_non_alphanumeric': 0.05156854318865492, 'fraction_numerical': 0.002578427159432746, 'mean_word_length': 3.5736738703339883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1773741', 'n_tokens_mistral': 592, 'n_tokens_neox': 565, 'n_words': 199}