Skip to content
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

Bug/WP-364: Ticket creation emails are not sent to 'cc' emails #1017

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/Tickets/TicketCreateForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function TicketCreateForm({
<FormField
name="cc"
label="Cc"
description="Separate emails with commas"
description="Separate emails with commas. NOTE: Emails listed here will only receive emails on replies to tickets."
/>
</Col>
</Row>
Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/onboarding/steps/project_membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def send_project_request(self, request):
username=self.user.username
),
Text=ticket_text,
Requestors=self.user.email,
Requestor=self.user.email,
CF_resource=settings.RT_TAG
)
tracker.logout()
Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/tickets/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def post(self, request):
data = request.POST.copy()
subject = data.get('subject')
problem_description = data.get('problem_description')
cc = data.get('cc', '')
cc = data.get('cc', [''])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be [''] or []? In another change in this PR, the default is []

attachments = [(f.name, ContentFile(f.read()), f.content_type)
for f in request.FILES.getlist('attachments')]
info = request.GET.get('info', "None")
Expand Down
8 changes: 4 additions & 4 deletions server/portal/apps/tickets/rtUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def __init__(self):

def getUserTickets(self, userEmail, status="ALL"):
if not status == "ALL":
ticket_list = self.tracker.search(Queue=rt.ALL_QUEUES, Requestors__exact=userEmail, Status__exact=status,
ticket_list = self.tracker.search(Queue=rt.ALL_QUEUES, Requestor__exact=userEmail, Status__exact=status,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a confirmed needed change as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my conversation with Chandra, he mentioned making this change anyhow.
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this is a different endpoint, tracker.search. Can you confirm the correct field is Requestor__exact?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The results appear to be the same regardless of whether that line says Requestor or Requestors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the results are the same, then we do not need to change, since nothing is broken. The issue from PR above is in create_ticket endpoint and not search endpoint. The parameter to create_ticket is Requestor (as seen in RT source code: ).

order='-LastUpdated')
else:
ticket_list = self.tracker.search(Queue=rt.ALL_QUEUES, Requestors__exact=userEmail, order='-LastUpdated')
ticket_list = self.tracker.search(Queue=rt.ALL_QUEUES, Requestor__exact=userEmail, order='-LastUpdated')

for ticket in ticket_list:
ticket['id'] = ticket['id'].replace('ticket/', '')
Expand All @@ -42,7 +42,7 @@ def getTicketHistory(self, ticket_id):

return ticketHistory

def create_ticket(self, attachments, subject, problem_description, requestor, cc):
def create_ticket(self, attachments, subject, problem_description, requestor, cc=[]):
return self.tracker.create_ticket(Queue=self.rtQueue,
files=attachments,
Subject=subject,
Expand All @@ -60,7 +60,7 @@ def replyToTicket(self, ticket_id, reply_text, files=[]):
def hasAccess(self, ticket_id, user=None):
if user and ticket_id:
ticket = self.tracker.get_ticket(ticket_id)
if DjangoRt.contains_user(ticket.get('Requestors', ''), user) or DjangoRt.contains_user(ticket.get('Cc', ''), user):
if DjangoRt.contains_user(ticket.get('Requestor', ''), user) or DjangoRt.contains_user(ticket.get('Cc', ''), user):
return True

return False
Expand Down
Loading