Skip to content

Commit e1c75d4

Browse files
authored
fix: disable removing liaison attachments pending reimplementation (#9555)
1 parent ad5823e commit e1c75d4

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

ietf/liaisons/tests.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -971,14 +971,14 @@ def test_liaison_edit_attachment(self):
971971
r = self.client.post(url, dict(title="New Title"))
972972
self.assertEqual(r.status_code, 404)
973973

974-
def test_liaison_delete_attachment(self):
975-
attachment = LiaisonStatementAttachmentFactory(document__name='liaiatt-1')
976-
liaison = attachment.statement
977-
url = urlreverse('ietf.liaisons.views.liaison_delete_attachment', kwargs=dict(object_id=liaison.pk,attach_id=attachment.pk))
978-
login_testing_unauthorized(self, "secretary", url)
979-
r = self.client.get(url)
980-
self.assertEqual(r.status_code, 302)
981-
self.assertEqual(liaison.liaisonstatementattachment_set.filter(removed=False).count(),0)
974+
# def test_liaison_delete_attachment(self):
975+
# attachment = LiaisonStatementAttachmentFactory(document__name='liaiatt-1')
976+
# liaison = attachment.statement
977+
# url = urlreverse('ietf.liaisons.views.liaison_delete_attachment', kwargs=dict(object_id=liaison.pk,attach_id=attachment.pk))
978+
# login_testing_unauthorized(self, "secretary", url)
979+
# r = self.client.get(url)
980+
# self.assertEqual(r.status_code, 302)
981+
# self.assertEqual(liaison.liaisonstatementattachment_set.filter(removed=False).count(),0)
982982

983983
def test_in_response(self):
984984
'''A statement with purpose=in_response must have related statement specified'''

ietf/liaisons/views.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818
from ietf.ietfauth.utils import role_required, has_role
1919
from ietf.group.models import Group, Role
20-
from ietf.liaisons.models import (LiaisonStatement,LiaisonStatementEvent,
21-
LiaisonStatementAttachment)
20+
from ietf.liaisons.models import LiaisonStatement,LiaisonStatementEvent
2221
from ietf.liaisons.utils import (get_person_for_user, can_add_outgoing_liaison,
2322
can_add_incoming_liaison, can_edit_liaison,can_submit_liaison_required,
2423
can_add_liaison)
@@ -377,23 +376,29 @@ def liaison_history(request, object_id):
377376

378377
def liaison_delete_attachment(request, object_id, attach_id):
379378
liaison = get_object_or_404(LiaisonStatement, pk=object_id)
380-
attach = get_object_or_404(LiaisonStatementAttachment, pk=attach_id)
379+
381380
if not can_edit_liaison(request.user, liaison):
382381
permission_denied(request, "You are not authorized for this action.")
383-
384-
# FIXME: this view should use POST instead of GET when deleting
385-
attach.removed = True
386-
attach.save()
387-
388-
# create event
389-
LiaisonStatementEvent.objects.create(
390-
type_id='modified',
391-
by=get_person_for_user(request.user),
392-
statement=liaison,
393-
desc='Attachment Removed: {}'.format(attach.document.title)
394-
)
395-
messages.success(request, 'Attachment Deleted')
396-
return redirect('ietf.liaisons.views.liaison_detail', object_id=liaison.pk)
382+
else:
383+
permission_denied(request, "This operation is temporarily unavailable. Ask the secretariat to mark the attachment as removed using the admin.")
384+
385+
# The following will be replaced with a different approach in the next generation of the liaison tool
386+
# attach = get_object_or_404(LiaisonStatementAttachment, pk=attach_id)
387+
388+
# # FIXME: this view should use POST instead of GET when deleting
389+
# attach.removed = True
390+
# debug.say("Got here")
391+
# attach.save()
392+
393+
# # create event
394+
# LiaisonStatementEvent.objects.create(
395+
# type_id='modified',
396+
# by=get_person_for_user(request.user),
397+
# statement=liaison,
398+
# desc='Attachment Removed: {}'.format(attach.document.title)
399+
# )
400+
# messages.success(request, 'Attachment Deleted')
401+
# return redirect('ietf.liaisons.views.liaison_detail', object_id=liaison.pk)
397402

398403
def liaison_detail(request, object_id):
399404
liaison = get_object_or_404(LiaisonStatement, pk=object_id)

0 commit comments

Comments
 (0)