Merge branch 'develop' into feature/profiling

# Conflicts:
#	main/extra_func.py
This commit is contained in:
Andrew Smirnov
2021-04-29 20:12:00 +03:00
16 changed files with 59 additions and 21 deletions

View File

@@ -8,6 +8,7 @@ from django.utils import timezone
from zenpy import Zenpy
from zenpy.lib.exception import APIException
from zenpy.lib.api_objects import User as ZenpyUser, Ticket as ZenpyTicket
from zenpy.lib.generator import SearchResultGenerator
from access_controller.settings import ZENDESK_ROLES as ROLES, ACTRL_ZENDESK_SUBDOMAIN
from main.models import UserProfile, RoleChangeLogs, UnassignedTicket, UnassignedTicketStatus
@@ -48,7 +49,7 @@ def make_light_agent(user_profile: UserProfile, who_changes: User) -> None:
:param user_profile: Профиль пользователя
:return: Вызов функции **update_role** с параметрами: профиль пользователя, роль "light_agent"
"""
tickets = get_tickets_list(user_profile.user.email)
tickets: SearchResultGenerator = get_tickets_list(user_profile.user.email)
ticket: ZenpyTicket
for ticket in tickets:
UnassignedTicket.objects.create(
@@ -61,9 +62,10 @@ def make_light_agent(user_profile: UserProfile, who_changes: User) -> None:
else:
ticket.assignee = None
ticket.group_id = zenpy.buffer_group_id
if tickets:
zenpy.admin.tickets.update(tickets)
attempts, success = 20, False
zenpy.admin.tickets.update(tickets.values)
attempts, success = 5, False
while not success and attempts != 0:
try:
update_role(user_profile, ROLES['light_agent'])

View File

@@ -29,7 +29,7 @@
</div>
{% for message in messages %}
<script>create_notification('{{message}}','','{{message.tags}}',5000)</script>
<script>create_notification('{{message}}','','{{message.tags}}',2000)</script>
{% endfor %}
{% block form %}

View File

@@ -31,6 +31,7 @@
alt="Нет изображения"
>
</div>
<a href="{%url 'password_change' %}">Сменить пароль</a>
</div>
<div class="col">
<h5><span class="badge bg-secondary text-light">Имя пользователя</span> {{ profile.name }}</h5>

View File

@@ -72,7 +72,7 @@
</form>
</div>
{% for message in messages %}
<script>create_notification('{{message}}','','{{message.tags}}',5000)</script>
<script>create_notification('{{message}}','','{{message.tags}}',2000)</script>
{% endfor %}
</div>
</div>

View File

@@ -0,0 +1,12 @@
{% extends "base/base.html" %}
{% load static %}
{% block title %}Пароль успешно изменен{% endblock title %}
{% block heading %}Пароль успешно изменен{% endblock %}
{% block content %}
<div>
<h4>Ваш пароль был изменен.</h4>
</div>
{% endblock content %}

View File

@@ -0,0 +1,14 @@
{% extends "base/base.html" %}
{% load static %}
{% block title %}Изменение пароля{% endblock title %}
{% block heading %}Сменить пароль{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Сменить" class="btn btn-success">
</form>
{% endblock content %}

View File

@@ -1,3 +1,2 @@
from django.test import TestCase
# Create your tests here.
from django.test import TestCase, Client
import access_controller.settings as sets