File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,7 +114,31 @@ def get_absolute_url(self):
114114 class Meta :
115115 db_table = 'liaison_detail'
116116
117+ def notify_pending_by_email (self , fake ):
118+ from ietf .liaisons .utils import IETFHM
119+
120+ from_entity = IETFHM .get_entity_by_key (self .from_raw_code )
121+ if not from_entity :
122+ return None
123+ to_email = []
124+ for person in from_entity .can_approve ():
125+ to_email .append ('%s <%s>' % person .email ())
126+ subject = 'New Liaison Statement, "%s" needs your approval' % (self .title )
127+ from_email = settings .LIAISON_UNIVERSAL_FROM
128+ body = render_to_string ('liaisons/pending_liaison_mail.txt' ,
129+ {'liaison' : self ,
130+ })
131+ mail = IETFEmailMessage (subject = subject ,
132+ to = to_email ,
133+ from_email = from_email ,
134+ body = body )
135+ if not fake :
136+ mail .send ()
137+ return mail
138+
117139 def send_by_email (self , fake = False ):
140+ if self .is_pending ():
141+ return self .notify_pending_by_email (fake )
118142 subject = 'New Liaison Statement, "%s"' % (self .title )
119143 from_email = settings .LIAISON_UNIVERSAL_FROM
120144 to_email = self .to_poc .split (',' )
@@ -137,6 +161,9 @@ def send_by_email(self, fake=False):
137161 mail .send ()
138162 return mail
139163
164+ def is_pending (self ):
165+ return bool (self .approval and not self .approval .approved )
166+
140167
141168class SDOs (models .Model ):
142169 sdo_id = models .AutoField (primary_key = True )
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ def get_from_cc(self, person=None):
4444 def needs_approval (self , person = None ):
4545 return False
4646
47+ def can_approve (self ):
48+ return []
49+
4750
4851class IETFEntity (Entity ):
4952
@@ -62,6 +65,9 @@ def needs_approval(self, person=None):
6265 return False
6366 return True
6467
68+ def can_approve (self ):
69+ return [self .poc ]
70+
6571
6672class IABEntity (Entity ):
6773 chair = FakePerson (** IABCHAIR )
@@ -83,6 +89,9 @@ def needs_approval(self, person=None):
8389 return False
8490 return True
8591
92+ def can_approve (self ):
93+ return [self .chair ]
94+
8695
8796class AreaEntity (Entity ):
8897
@@ -103,6 +112,9 @@ def needs_approval(self, person=None):
103112 return False
104113 return True
105114
115+ def can_approve (self ):
116+ return self .get_poc ()
117+
106118
107119class WGEntity (Entity ):
108120
@@ -130,6 +142,9 @@ def needs_approval(self, person=None):
130142 return False
131143 return True
132144
145+ def can_approve (self ):
146+ return [i .person for i in self .obj .area .area .areadirector_set .all ()]
147+
133148
134149class SDOEntity (Entity ):
135150
Original file line number Diff line number Diff line change 1+ The following liaison statement will remain pending (and not public available) in the system until you approve it:
2+
3+ Title: {{ liaison.title }}
4+ Submission Date: {{ liaison.submitted_date }}
5+ URL of the IETF Web page: {% url liaison_approval_detail liaison.pk %}
6+ {% if liaison.deadline_date %}Please reply by {{ liaison.deadline_date }}{% endif %}
7+ From: {{ liaison.from_body }} ({{ liaison.person }} <{{ liaison.replyto|default:liaison.from_email|fix_ampersands }}>)
8+ To: {{ liaison.to_body }} ({{ liaison.to_poc }})
9+ Cc: {{ liaison.cc1 }}
10+ Reponse Contact: {{ liaison.response_contact }}
11+ Technical Contact: {{ liaison.technical_contact }}
12+ Purpose: {% if liaison.purpose_text %}{{ liaison.purpose_text }}{% else %}{{ liaison.purpose.purpose_text }}{% endif %}
13+ Body: {{ liaison.body }}
14+ Attachment(s):
15+ {% for file in liaison.uploads_set.all %}
16+ {{ file.file_title }} https://datatracker.ietf.org/documents/LIAISON/file{{ file.file_id }}{{ file.file_extension }}
17+ {% empty %}
18+ No document has been attached
19+ {% endfor %}
20+
21+
22+ Please visit {% url liaison_approval_detail liaison.pk %} in order to approve the liaison statement.
You can’t perform that action at this time.
0 commit comments