Skip to content

Commit

Permalink
Remove code of draft (#7154)
Browse files Browse the repository at this point in the history
* initiate

* update

* update

* Update models.py

* Update settings.py

* update

* update
  • Loading branch information
r350178982 authored Dec 6, 2024
1 parent f4d15fb commit 7e2bbda
Show file tree
Hide file tree
Showing 31 changed files with 15 additions and 1,718 deletions.
14 changes: 0 additions & 14 deletions seahub/api2/endpoints/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from seahub.api2.authentication import TokenAuthentication
from seahub.base.templatetags.seahub_tags import email2nickname
from seahub.avatar.templatetags.avatar_tags import api_avatar_url
from seahub.drafts.models import Draft

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -81,19 +80,6 @@ def get(self, request, format=None):
d['old_name'] = os.path.basename(e.old_path)
elif e.op_type == 'publish':
d['old_path'] = e.old_path
elif d['name'].endswith('(draft).md'):
if e.op_type in ('create', 'edit') and e.obj_type == 'file':
try:
draft = Draft.objects.filter(username=e.op_user,
origin_repo_id=e.repo_id,
draft_file_path=e.path)
if draft:
draft = draft[0]
d['draft_id'] = draft.id
else:
Draft.DoesNotExist
except Draft.DoesNotExist:
pass

events_list.append(d)

Expand Down
15 changes: 0 additions & 15 deletions seahub/api2/endpoints/admin/user_activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from seahub.api2.authentication import TokenAuthentication
from seahub.base.templatetags.seahub_tags import email2nickname
from seahub.avatar.templatetags.avatar_tags import api_avatar_url
from seahub.drafts.models import Draft

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -98,20 +97,6 @@ def get(self, request):
d['old_name'] = os.path.basename(e.old_path)
elif e.op_type == 'publish':
d['old_path'] = e.old_path
elif d['name'].endswith('(draft).md'):
if e.op_type in ('create', 'edit') and e.obj_type == 'file':
try:
draft = Draft.objects.filter(username=e.op_user,
origin_repo_id=e.repo_id,
draft_file_path=e.path)
if draft:
draft = draft[0]
d['draft_id'] = draft.id
else:
Draft.DoesNotExist
except Draft.DoesNotExist:
pass

events_list.append(d)

response = {'events': events_list}
Expand Down
20 changes: 0 additions & 20 deletions seahub/api2/endpoints/admin/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -1901,26 +1901,6 @@ def put(self, request):
except Exception as e:
logger.error(e)

try:
from seahub.drafts.models import Draft
draft_list = Draft.objects.filter(username=old_ccnet_email)
for draft in draft_list:
draft.username = new_ccnet_email
draft.save()
logger.debug('the drafts_draft table in seahub database was successfully updated')
except Exception as e:
logger.error(e)

try:
from seahub.drafts.models import DraftReviewer
draftreviewer_list = DraftReviewer.objects.filter(reviewer=old_ccnet_email)
for draftreviewer in draftreviewer_list:
draftreviewer.reviewer = new_ccnet_email
draftreviewer.save()
logger.debug('the drafts_draftreviewer table in seahub database was successfully updated')
except Exception as e:
logger.error(e)

try:
from seahub.file_participants.models import FileParticipant
fileparticipant_list = FileParticipant.objects.filter(username=old_ccnet_email)
Expand Down
152 changes: 0 additions & 152 deletions seahub/api2/endpoints/draft_reviewer.py

This file was deleted.

Loading

0 comments on commit 7e2bbda

Please sign in to comment.