Skip to content

Commit e24d240

Browse files
committed
dont update authors automatically
1 parent c3f8f34 commit e24d240

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

gateway/sds_gateway/api_methods/models.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from django.db import models
1515
from django.db.models import ProtectedError
1616
from django.db.models import QuerySet
17-
from django.db.models.signals import post_delete
1817
from django.db.models.signals import post_save
1918
from django.db.models.signals import pre_delete
2019
from django.dispatch import receiver
@@ -665,15 +664,6 @@ def from_db(cls, db, field_names, values):
665664
setattr(instance, field, json.loads(getattr(instance, field)))
666665
return instance
667666

668-
def update_authors_field(self):
669-
"""Update the authors field based on current permissions."""
670-
authors_data = UserSharePermission.get_dataset_authors(self.uuid)
671-
author_names = [author["name"] for author in authors_data]
672-
673-
# Update the authors field
674-
self.authors = author_names
675-
self.save(update_fields=["authors"])
676-
677667
def get_authors_display(self):
678668
"""Get the authors as a list for display purposes."""
679669
if not self.authors:
@@ -1428,35 +1418,3 @@ def handle_sharegroup_soft_delete(sender, instance: ShareGroup, **kwargs) -> Non
14281418
# Update the enabled status based on remaining groups
14291419
permission.update_enabled_status()
14301420
permission.save()
1431-
1432-
1433-
@receiver(post_save, sender=UserSharePermission)
1434-
def handle_usersharepermission_change(
1435-
sender, instance: UserSharePermission, **kwargs
1436-
) -> None:
1437-
"""
1438-
Handle changes to UserSharePermission by updating dataset authors field.
1439-
"""
1440-
if instance.item_type == ItemType.DATASET and instance.is_enabled:
1441-
# Update the authors field for the dataset
1442-
dataset = Dataset.objects.filter(
1443-
uuid=instance.item_uuid, is_deleted=False
1444-
).first()
1445-
if dataset:
1446-
dataset.update_authors_field()
1447-
1448-
1449-
@receiver(post_delete, sender=UserSharePermission)
1450-
def handle_usersharepermission_delete(
1451-
sender, instance: UserSharePermission, **kwargs
1452-
) -> None:
1453-
"""
1454-
Handle deletion of UserSharePermission by updating dataset authors field.
1455-
"""
1456-
if instance.item_type == ItemType.DATASET:
1457-
# Update the authors field for the dataset
1458-
dataset = Dataset.objects.filter(
1459-
uuid=instance.item_uuid, is_deleted=False
1460-
).first()
1461-
if dataset:
1462-
dataset.update_authors_field()

0 commit comments

Comments
 (0)