-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User messaging #69
base: master
Are you sure you want to change the base?
User messaging #69
Conversation
messaging/views.py
Outdated
return render(request, template_name, {'message_list': message_list}) | ||
|
||
|
||
@login_required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
messaging/views.py
Outdated
return render(request, template_name, {'message_list': message_list}) | ||
|
||
|
||
@login_required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
return render(request, template_name, {'inbox_count': inbox_count(user=request.user)}) | ||
|
||
|
||
@login_required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
|
||
|
||
@login_required | ||
def compose(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function compose
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
|
||
|
||
@login_required | ||
def reply(request, message_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function reply
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
if parent.sender != request.user and parent.recipient != request.user: | ||
raise Http404 | ||
|
||
if request.method == 'POST': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
|
||
context = {'message': message, 'reply_form': None} | ||
if message.recipient == user: | ||
form = form_class(initial={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
Might be better off converting these FBVs to CBVs to reduce cognitive complexity and reduce identical code blocks? |
|
||
|
||
@login_required | ||
def reply(request, message_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function reply
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
|
||
"""Views for Inbox OR Outbox OR Trash""" | ||
|
||
if key == 'inbox': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
message_list = Message.objects.inbox_for(request.user) | ||
template_name = 'messaging/inbox.html' | ||
return render(request, template_name, {'message_list': message_list}) | ||
elif key == 'outbox': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
message_list = Message.objects.outbox_for(request.user) | ||
template_name = 'messaging/outbox.html' | ||
return render(request, template_name, {'message_list': message_list}) | ||
elif key == 'trash': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
Single User to User messaging functionality. Still features to work on to make user experience friendlier.