launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19416
Re: [Merge] lp:~cjwatson/launchpad/import-warnings into lp:launchpad
Diff comments:
>
> === modified file 'lib/lp/soyuz/model/archivesubscriber.py'
> --- lib/lp/soyuz/model/archivesubscriber.py 2015-07-08 16:05:11 +0000
> +++ lib/lp/soyuz/model/archivesubscriber.py 2015-09-21 10:22:52 +0000
> @@ -204,7 +212,20 @@
>
> def getBySubscriberWithActiveToken(self, subscriber, archive=None):
> """See `IArchiveSubscriberSet`."""
> - return self._getBySubscriber(subscriber, archive, True, True)
> + result = self._getBySubscriber(subscriber, archive, True, True)
> +
> + def eager_load(rows):
> + user = getUtility(ILaunchBag).user
> + subscriptions = map(itemgetter(0), rows)
> + precache_permission_for_objects(
> + None, 'launchpad.View', subscriptions)
> + archives = load_related(Archive, subscriptions, ['archive_id'])
> + list(getUtility(IPersonSet).getPrecachedPersonsFromIDs(
> + [archive.ownerID for archive in archives], need_validity=True))
> + for archive in archives:
> + get_property_cache(archive)._known_subscribers = [user]
The only people who can see the view can see the subscriptions, indeed, so it's safe to make the assumption in the view. But it's not "this view", as this is the model.
> +
> + return DecoratedResultSet(result, pre_iter_hook=eager_load)
>
> def getByArchive(self, archive, current_only=True):
> """See `IArchiveSubscriberSet`."""
--
https://code.launchpad.net/~cjwatson/launchpad/import-warnings/+merge/271790
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
References