Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/lib/admin/actions/package_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import 'package:pub_dev/package/backend.dart';

import '../../account/backend.dart';
import '../../account/models.dart';
import 'actions.dart';

final packageInfo = AdminAction(
Expand All @@ -27,11 +29,18 @@ Loads and displays the package information.
throw NotFoundException.resource(package);
}

final uploaderIds = p.uploaders;
List<User>? uploaders;
if (uploaderIds != null) {
uploaders =
(await accountBackend.lookupUsersById(uploaderIds)).nonNulls.toList();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: getEmailsOfUserIds will use cache and may be faster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, switched

}
return {
'package': {
'name': p.name,
'created': p.created?.toIso8601String(),
'publisherId': p.publisherId,
'uploaders': uploaders?.map((u) => u.email).toList(),
'latestVersion': p.latestVersion,
'isModerated': p.isModerated,
if (p.moderatedAt != null)
Expand Down
1 change: 1 addition & 0 deletions app/test/admin/package_actions_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void main() {
'name': 'oxygen',
'created': isNotEmpty,
'publisherId': null,
'uploaders': ['[email protected]'],
'latestVersion': '1.2.0',
'isModerated': false,
}
Expand Down
Loading