Skip to content
Open
Changes from all commits
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
1 change: 1 addition & 0 deletions lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ function addSiteController(router, site, providers) {
_.assign(site, _.pick(controller, 'resolvePublishing'));
_.assign(site, _.pick(controller, 'resolvePublishUrl'));
_.assign(site, _.pick(controller, 'modifyPublishedData'));
_.assign(site, _.pick(controller, 'assignToMetaOnPublish'));
Comment on lines 177 to +180
Copy link
Contributor

@macgyver macgyver Aug 2, 2024

Choose a reason for hiding this comment

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

i know this is just like.. the pattern set by whoever came before, but wouldn't this be written more simply as

    _.assign(site, {
      providers,
      // things to remember from controller
      ..._.pick(controller, 'resolvePublishing', 'resolvePublishUrl', 'modifyPublishedData', 'assignToMetaOnPublish')
    });

or like.. w/o lodash...

    Object.assign(site, {
      providers,
      // I don't know why it's important that we not just assign everything from the controller
      resolvePublishing: controller.resolvePublishing,
      resolvePublishUrl: controller.resolvePublishUrl,
      modifyPublishedData: controller.modifyPublishedData,
      assignToMetaOnPublish: controller.assignToMetaOnPublish
    });

}
}

Expand Down