File tree Expand file tree Collapse file tree 3 files changed +6
-34
lines changed Expand file tree Collapse file tree 3 files changed +6
-34
lines changed Original file line number Diff line number Diff line change @@ -300,17 +300,12 @@ Future<shelf.Response> _handlePackagePage({
300300
301301 if (cachedPage == null ) {
302302 final package = await packageBackend.lookupPackage (packageName);
303- if (package == null || ! package.isVisible) {
304- if (package? .isModerated ?? false ) {
305- final content = renderModeratedPackagePage (packageName);
306- return htmlResponse (content, status: 404 );
307- }
308- if (await packageBackend.isPackageModerated (packageName)) {
309- final content = renderModeratedPackagePage (packageName);
310- return htmlResponse (content, status: 404 );
311- } else {
312- return formattedNotFoundHandler (request);
313- }
303+ if (package == null ) {
304+ return formattedNotFoundHandler (request);
305+ }
306+ if (package.isNotVisible) {
307+ final content = renderModeratedPackagePage (packageName);
308+ return htmlResponse (content, status: 404 );
314309 }
315310 final serviceSw = Stopwatch ()..start ();
316311 final PackagePageData data;
Original file line number Diff line number Diff line change @@ -110,18 +110,6 @@ class PackageBackend {
110110 }))! ;
111111 }
112112
113- /// Whether the package has been deleted and a [ModeratedPackage] entity exists for it.
114- Future <bool > isPackageModerated (String package) async {
115- return (await cache.packageModerated (package).get (() async {
116- final visible = await isPackageVisible (package);
117- if (visible) {
118- return false ;
119- }
120- final p = await lookupModeratedPackage (package);
121- return p != null ;
122- }))! ;
123- }
124-
125113 Stream <Package > allPackages () => db.query <Package >().run ();
126114
127115 Stream <String > allPackageNames () {
@@ -1783,7 +1771,6 @@ api.PackagePublisherInfo _asPackagePublisherInfo(Package p) =>
17831771Future <void > purgePackageCache (String package) async {
17841772 await Future .wait ([
17851773 cache.packageVisible (package).purge (),
1786- cache.packageModerated (package).purge (),
17871774 cache.packageData (package).purge (),
17881775 cache.packageDataGz (package).purge (),
17891776 cache.packageLatestVersion (package).purge (),
Original file line number Diff line number Diff line change @@ -130,16 +130,6 @@ class CachePatterns {
130130 decode: (d) => d as bool ,
131131 ))[package];
132132
133- Entry <bool > packageModerated (String package) => _cache
134- .withPrefix ('package-moderated/' )
135- .withTTL (Duration (days: 7 ))
136- .withCodec (utf8)
137- .withCodec (json)
138- .withCodec (wrapAsCodec (
139- encode: (bool value) => value,
140- decode: (d) => d as bool ,
141- ))[package];
142-
143133 Entry <List <int >> packageData (String package) => _cache
144134 .withPrefix ('api-package-data-by-uri/' )
145135 .withTTL (Duration (minutes: 10 ))['$package ' ];
You can’t perform that action at this time.
0 commit comments