Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate asset and authors helpers to es6 #10611

Merged
merged 2 commits into from
Mar 26, 2019

Conversation

vikaspotluri123
Copy link
Member

Refs #9589

  • Update code style for asset helper
  • Migrate authors helper


const autolink = !(_.isString(options.hash.autolink) && options.hash.autolink === 'false'),
separator = _.isString(options.hash.separator) ? options.hash.separator : ', ',
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not fully sure if we can get rid of this logic, but it seems like we should be able to 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔Thinking if losing the isString check in the destructuring default value here has any downsides. Seems it differs only when non-string value is passed to separator, which should be wrong usage so can be ignored as case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the only possible case I can think of is if the theme author passes in a variable (e.g. number of posts) 😟

Copy link
Contributor

Choose a reason for hiding this comment

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

@vikaspotluri123 Ah yeah, but passing number of posts in as a separator is still wrong usage in a way right? 😄I mean previously we would have just ignored it and set , as separator, so I think the changes are still ok ;) Wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree 😄

limit = options.hash.limit ? parseInt(options.hash.limit, 10) : undefined,
visibilityArr = models.Base.Model.parseVisibilityString(options.hash.visibility);
module.exports = function authors(options = {}) {
options.hash = options.hash || {};
Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't use nested destructuring here because the input can be considered untrusted

@kirrg001
Copy link
Contributor

@rishabhgrg Could you please review & merge next Monday? Thaaanks 🙂

@rishabhgrg rishabhgrg merged commit 960993b into TryGhost:master Mar 26, 2019
allouis added a commit that referenced this pull request Mar 26, 2019
* master:
  Version bump to 2.19.0
  Updated Ghost-Admin to 2.19.0
  Migrated asset and author helpers to es6 (#10611)
  🐛 Fixed AMP output when there is a trailing '$'
  Model regression tests cleanup (#10639)
@vikaspotluri123 vikaspotluri123 deleted the es6-assets-a branch March 26, 2019 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants