Skip to content

Commit

Permalink
optimize to_user field when receive share from other server (#6287)
Browse files Browse the repository at this point in the history
  • Loading branch information
imwhatiam authored Jul 4, 2024
1 parent 1f75bee commit d982009
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion seahub/api2/endpoints/ocm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from seahub.utils.repo import get_available_repo_perms, get_repo_owner
from seahub.base.templatetags.seahub_tags import email2nickname
from seahub.constants import PERMISSION_READ, PERMISSION_READ_WRITE

from seahub.profile.models import Profile
from seahub.ocm.models import OCMShareReceived, OCMShare
from seahub.ocm.settings import ENABLE_OCM, SUPPORTED_OCM_PROTOCOLS, \
OCM_SEAFILE_PROTOCOL, OCM_RESOURCE_TYPE_LIBRARY, OCM_API_VERSION, \
Expand Down Expand Up @@ -198,10 +200,11 @@ def post(self, request):
else:
permission = PERMISSION_READ

share_with_ccnet_email = Profile.objects.get_username_by_contact_email(share_with)
OCMShareReceived.objects.add(
shared_secret=shared_secret,
from_user=sender,
to_user=share_with,
to_user=share_with_ccnet_email or share_with,
from_server_url=from_server_url,
repo_id=repo_id,
repo_name=repo_name,
Expand Down

0 comments on commit d982009

Please sign in to comment.