Skip to content

Commit 53fae6e

Browse files
committed
Hide 'send and post' button to SDO Liaison Managers when they select their SDO in the from field. Fixes ietf-tools#577
- Legacy-Id: 2786
1 parent 79785fe commit 53fae6e

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

ietf/liaisons/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def needs_approval(self, person=None):
4747
def can_approve(self):
4848
return []
4949

50+
def post_only(self, person):
51+
return False
52+
5053

5154
class IETFEntity(Entity):
5255

@@ -163,6 +166,9 @@ def get_from_cc(self, person=None):
163166
return [manager.person]
164167
return []
165168

169+
def post_only(self, person):
170+
return bool(self.obj.liaisonmanagers_set.filter(person=person))
171+
166172

167173
class EntityManager(object):
168174

ietf/liaisons/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_info(request):
5353
to_entity_id = request.GET.get('to_entity_id', None)
5454
from_entity_id = request.GET.get('from_entity_id', None)
5555

56-
result = {'poc': [], 'cc': [], 'needs_approval': False}
56+
result = {'poc': [], 'cc': [], 'needs_approval': False, 'post_only': False}
5757

5858
to_error = 'Invalid TO entity id'
5959
if to_entity_id:
@@ -74,7 +74,8 @@ def get_info(request):
7474
'cc': [i.email() for i in to_entity.get_cc(person=person)] +\
7575
[i.email() for i in from_entity.get_from_cc(person=person)],
7676
'poc': [i.email() for i in to_entity.get_poc()],
77-
'needs_approval': from_entity.needs_approval(person=person)})
77+
'needs_approval': from_entity.needs_approval(person=person),
78+
'post_only': from_entity.post_only(person=person)})
7879
json_result = simplejson.dumps(result)
7980
return HttpResponse(json_result, mimetype='text/javascript')
8081

static/js/liaisons.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,14 @@
172172
}
173173
};
174174

175+
var checkPostOnly = function(post_only) {
176+
if (post_only) {
177+
$("input[name=send]").hide();
178+
} else {
179+
$("input[name=send]").show();
180+
}
181+
};
182+
175183
var updateInfo = function() {
176184
var entity = organization;
177185
var to_entity = from;
@@ -189,6 +197,7 @@
189197
render_mails_into(cc, response.cc);
190198
render_mails_into(poc, response.poc);
191199
toggleApproval(response.needs_approval);
200+
checkPostOnly(response.post_only);
192201
}
193202
}
194203
});

0 commit comments

Comments
 (0)