-
Notifications
You must be signed in to change notification settings - Fork 0
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
Hd staff mentions #17
base: develop
Are you sure you want to change the base?
Conversation
…pdesk for Colorado
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.
Played around with it, it's working really well!
formatted_mention = f'<span style="color:blue">@{user.first_name} {user.last_name}</span>' | ||
|
||
return formatted_mention | ||
except User.DoesNotExist: |
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.
It's possible for two users to have the same first and last name, so I would also catch User.MultipleObjectsReturned as well as User.DoesNotExist
helpdesk/views/staff.py
Outdated
mention_pattern = re.compile(r'@\"(.*?)\"') | ||
|
||
for match in mention_pattern.findall(comment): | ||
first_name, last_name = match.split() |
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.
Add the code where you check for the email address as well as the first name / last name
helpdesk/views/staff.py
Outdated
user=user, | ||
ticket=ticket, | ||
organization=ticket.ticket_form.organization, | ||
message = "You have been mentioned in ticket " + str(ticket.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.
Could you change the message to "<request user's name/email> mentioned you on ticket <ticket id>"?
helpdesk/views/staff.py
Outdated
|
||
mention_pattern = re.compile(r'@\"(.*?)\"') | ||
|
||
for match in mention_pattern.findall(comment): |
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.
Only staff users are allowed to use Markdown, so check that request.user is HD staff first
helpdesk/views/staff.py
Outdated
|
||
for match in mention_pattern.findall(comment): | ||
first_name, last_name = match.split() | ||
user = User.objects.get(first_name=first_name, last_name=last_name) |
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.
Staff shouldn't be able to @ users who aren't staff, so after finding user
, check that it's staff
|
||
try: | ||
if '@' in mention: | ||
user = User.objects.get(email=mention) |
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.
Staff shouldn't be able to @ users who aren't staff, so after finding user
, check that it's staff
Adds ability for Helpdesk Users to @ other Helpdesk Users in followup comments