launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23140
Re: [Merge] lp:~cjwatson/launchpad/snapshot-modifying-helper-use-answers into lp:launchpad
Review: Needs Fixing
Diff comments:
> === modified file 'lib/lp/answers/browser/question.py'
> --- lib/lp/answers/browser/question.py 2018-08-09 15:08:14 +0000
> +++ lib/lp/answers/browser/question.py 2018-11-18 18:00:36 +0000
> @@ -364,27 +361,23 @@
> # No post, nothing to do
> return
>
> - question_unmodified = Snapshot(
> - self.context, providing=providedBy(self.context))
> modified_fields = set()
> -
> - response = self.request.response
> - # Establish if a subscription form was posted.
> - newsub = self.request.form.get('subscribe', None)
> - if newsub is not None:
> - if newsub == 'Subscribe':
> - self.context.subscribe(self.user)
> - response.addNotification(
> - _("You have subscribed to this question."))
> - modified_fields.add('subscribers')
> - elif newsub == 'Unsubscribe':
> - self.context.unsubscribe(self.user, self.user)
> - response.addNotification(
> - _("You have unsubscribed from this question."))
> - modified_fields.add('subscribers')
> - response.redirect(canonical_url(self.context))
> - notify(ObjectModifiedEvent(
> - self.context, question_unmodified, list(modified_fields)))
> + with notify_modified(self.context):
> + response = self.request.response
> + # Establish if a subscription form was posted.
> + newsub = self.request.form.get('subscribe', None)
> + if newsub is not None:
> + if newsub == 'Subscribe':
> + self.context.subscribe(self.user)
> + response.addNotification(
> + _("You have subscribed to this question."))
> + modified_fields.add('subscribers')
> + elif newsub == 'Unsubscribe':
> + self.context.unsubscribe(self.user, self.user)
> + response.addNotification(
> + _("You have unsubscribed from this question."))
> + modified_fields.add('subscribers')
> + response.redirect(canonical_url(self.context))
How does modified_fields work now that it's not passed into the ObjectModifiedEvent?
>
> @property
> def page_title(self):
--
https://code.launchpad.net/~cjwatson/launchpad/snapshot-modifying-helper-use-answers/+merge/358962
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
References