1.1 --- a/imipweb/resource.py Mon Oct 12 17:41:06 2015 +0200
1.2 +++ b/imipweb/resource.py Mon Oct 12 17:42:03 2015 +0200
1.3 @@ -138,6 +138,9 @@
1.4 def _have_request(self, uid, recurrenceid=None, type=None, strict=False):
1.5 return self.store.have_request(self._get_requests(), uid, recurrenceid, type, strict)
1.6
1.7 + def _is_request(self):
1.8 + return self._have_request(self.uid, self.recurrenceid)
1.9 +
1.10 def _get_counters(self, uid, recurrenceid=None):
1.11 return self.store.get_counters(self.user, uid, recurrenceid)
1.12
1.13 @@ -280,24 +283,28 @@
1.14 self._send_message(get_address(self.user), [get_address(attendee)], parts=[obj.to_part(method)])
1.15 return True
1.16
1.17 - def process_received_request(self):
1.18 + def process_received_request(self, changed=False):
1.19
1.20 """
1.21 Process the current request for the current user. Return whether any
1.22 - action was taken.
1.23 + action was taken. If 'changed' is set to a true value, or if 'attendees'
1.24 + is specified and differs from the stored attendees, a counter-proposal
1.25 + will be sent instead of a reply.
1.26 """
1.27
1.28 # Reply only on behalf of this user.
1.29
1.30 - attendee_attr = self.update_participation(self.obj)
1.31 + attendee_attr = self.update_participation()
1.32
1.33 if not attendee_attr:
1.34 return False
1.35
1.36 - self.obj["ATTENDEE"] = [(self.user, attendee_attr)]
1.37 + if not changed:
1.38 + self.obj["ATTENDEE"] = [(self.user, attendee_attr)]
1.39 +
1.40 self.update_dtstamp()
1.41 self.update_sequence(False)
1.42 - self.send_message("REPLY", get_address(self.user), from_organiser=False)
1.43 + self.send_message(changed and "COUNTER" or "REPLY", get_address(self.user), from_organiser=False)
1.44 return True
1.45
1.46 def process_created_request(self, method, to_cancel=None, to_unschedule=None):
1.47 @@ -581,8 +588,9 @@
1.48 page = self.page
1.49
1.50 # Show controls for editing as organiser.
1.51 + # NOTE: Allow attendees to edit datetimes for counter-proposals.
1.52
1.53 - if self.is_organiser():
1.54 + if self.can_change_object():
1.55 page.td(class_="objectvalue dt%s" % (show_start and "start" or "end"))
1.56
1.57 if show_start:
1.58 @@ -635,8 +643,9 @@
1.59 replaced = not recurrenceid and p.is_replaced(recurrenceids)
1.60
1.61 # Show controls for editing as organiser.
1.62 + # NOTE: Allow attendees to edit datetimes for counter-proposals.
1.63
1.64 - if self.is_organiser() and not replaced:
1.65 + if self.can_change_object() and not replaced:
1.66 page.td(class_="objectvalue dt%s" % (show_start and "start" or "end"))
1.67
1.68 read_only = period.origin == "RRULE"