Skip to content

Feature/active snippets#56

Merged
gtluszcz merged 5 commits intomasterfrom
feature/active_snippets
Oct 18, 2018
Merged

Feature/active snippets#56
gtluszcz merged 5 commits intomasterfrom
feature/active_snippets

Conversation

@gtluszcz
Copy link
Copy Markdown
Member

This pull adds activeness of snippets.
From now on you will be able to deactivate certain snippet and activate it again!

zrzut ekranu 2018-10-13 o 23 54 13

@gtluszcz gtluszcz requested a review from DCzajkowski October 13, 2018 21:54
Copy link
Copy Markdown
Member

@DCzajkowski DCzajkowski left a comment

Choose a reason for hiding this comment

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

Are you planning to add tests for these features? We should probably require tests on all future PRs and invest some more time in heavy testing.

_addNewFields() {
const newSnippets = this.store.get('snippets').map(s => {
s.active = s.active || true
s.regex = s.regex || false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These won't work. If someone sets active to false, you would map it to true 😛

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The === undefined check would be appropriate here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

omg i am so embarrassed right now xd

}

_addNewFields() {
const newSnippets = this.store.get('snippets').map(s => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd personally either inline this variable or just call it const snippets. Just a personal preference.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ok

this._addNewFields()
}

_addNewFields() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

_addNewFields -> _ensureAllFieldsArePresent? "Add new fields" implies new fields are always added, where in fact the function is just ensuring everything is set properly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

okay fine 👍


Use Regular Expression
</label>
active
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"active" -> "Active" to preserve Title Case style.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good catch

@gtluszcz
Copy link
Copy Markdown
Member Author

I don't really have experience with unit tests in js. To be honest i wasn't gonna do that, although i see clearly that we are missing tests and we should start to write them. I have to catch up on this fast!

@gtluszcz gtluszcz merged commit f04d8bf into master Oct 18, 2018
@gtluszcz gtluszcz deleted the feature/active_snippets branch October 18, 2018 14:50
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