-
Notifications
You must be signed in to change notification settings - Fork 436
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
Mentions PoC #9279
base: main
Are you sure you want to change the base?
Mentions PoC #9279
Conversation
|
||
@staticmethod | ||
def _parse_userids(text: str) -> list[str]: | ||
return USERID_PAT.findall(text) |
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.
We'll probably want to parse userids from text_rendered
html.
h/services/mention.py
Outdated
import re | ||
from typing import Iterable, Sequence | ||
|
||
import sqlalchemy as sa |
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.
I wouldn't be shy about importing anything from sqlalchemy. I mean speling the whole from sqlalchemy import select, ....
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.
No problem, is this the recommended way?
h/migrations/versions/022ea4bf4a27_update_mention_to_reference_annotation.py
Show resolved
Hide resolved
return [notification.mentioned_user.email], subject, text, html | ||
|
||
|
||
def _get_user_url(user, 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.
Copied from emails/reply_notifcation.py
for now
return [] | ||
|
||
notifications = [] | ||
for mention in annotation.mentions: |
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.
We will need to factor in groups / permissions / limits here as well to avoid sending notifications when not appropriate.
Refs #9281
Adds
@mentions
support in the API, emails will be addressed separately.All of create / get / edit / search endpoints now support them.
Testing API
make db
devdata_admin
and generate API token from http://localhost:5000/account/developercurl -X GET --location "http://localhost:5000/api/search" \ -H "Authorization: Bearer <token>"
Mentions will be returned here as well
Testing emails
Notifications are sent only on creation for now
h/mail
folder for incoming mail