Ejemplo n.º 1
0
def update_stream_backend(request, user_profile, stream_id,
                          description=REQ(validator=check_string, default=None),
                          is_private=REQ(validator=check_bool, default=None),
                          new_name=REQ(validator=check_string, default=None)):
    # type: (HttpRequest, UserProfile, int, Optional[Text], Optional[bool], Optional[Text]) -> HttpResponse
    stream = get_and_validate_stream_by_id(stream_id, user_profile.realm)
    stream_name = stream.name

    if description is not None:
        do_change_stream_description(user_profile.realm, stream_name, description)
    if stream_name is not None and new_name is not None:
        do_rename_stream(user_profile.realm, stream_name, new_name)
    if is_private is not None:
        if is_private:
            do_make_stream_private(user_profile.realm, stream_name)
        else:
            do_make_stream_public(user_profile, user_profile.realm, stream_name)
    return json_success()
Ejemplo n.º 2
0
def update_stream_backend(request,
                          user_profile,
                          stream_name,
                          description=REQ(validator=check_string,
                                          default=None),
                          is_private=REQ(validator=check_bool, default=None),
                          new_name=REQ(validator=check_string, default=None)):
    # type: (HttpRequest, UserProfile, Text, Optional[Text], Optional[bool], Optional[Text]) -> HttpResponse
    if description is not None:
        do_change_stream_description(user_profile.realm, stream_name,
                                     description)
    if stream_name is not None and new_name is not None:
        do_rename_stream(user_profile.realm, stream_name, new_name)
    if is_private is not None:
        if is_private:
            do_make_stream_private(user_profile.realm, stream_name)
        else:
            do_make_stream_public(user_profile, user_profile.realm,
                                  stream_name)
    return json_success()
Ejemplo n.º 3
0
def json_make_stream_public(request, user_profile, stream_name=REQ()):
    # type: (HttpRequest, UserProfile, text_type) -> HttpResponse
    do_make_stream_public(user_profile, user_profile.realm, stream_name)
    return json_success()
Ejemplo n.º 4
0
def json_make_stream_public(request, user_profile, stream_name=REQ()):
    # type: (HttpRequest, UserProfile, str) -> HttpResponse
    do_make_stream_public(user_profile, user_profile.realm, stream_name)
    return json_success()
Ejemplo n.º 5
0
def json_make_stream_public(request, user_profile, stream_name=REQ):
    return json_success(
        do_make_stream_public(user_profile, user_profile.realm, stream_name))
Ejemplo n.º 6
0
def json_make_stream_public(request, user_profile, stream_name=REQ):
    return json_success(do_make_stream_public(user_profile, user_profile.realm, stream_name))