Open
Conversation
xepozz
requested changes
Sep 20, 2020
xepozz
requested changes
Oct 4, 2020
modules/posts/post/post.module.js
Outdated
| ; | ||
| }) | ||
| .factory('PostFactory', function (POST_REQUIRED_TAGS) { | ||
| .factory('PostFactory', function ($routeParams, POST_REQUIRED_TAGS) { |
Owner
There was a problem hiding this comment.
Неудачное место для метода. Фабрика - для создания объектов.
Текущий код можно положить прям в сущность, в которой будет getFullDescription и getShortDescription.
В контроллере уже вызывать нужный метод, основываясь на $routeParams
added 2 commits
October 4, 2020 17:49
xepozz
requested changes
Oct 6, 2020
| post: function (PostRepository, $route) { | ||
| post = PostRepository.getById($route.current.params.id); | ||
| return post | ||
| return post; |
Owner
There was a problem hiding this comment.
Please revert any not related changes
| this.dislikesCount = 0; | ||
|
|
||
| this.$onInit = () => { | ||
| setTimeout(()=> { |
| const delimiter = '<hr>' | ||
|
|
||
| if ($routeParams && !$routeParams.id && this.post.body.includes(delimiter)) { | ||
| description = Post().getShortDescription(this.post) |
Owner
There was a problem hiding this comment.
Suggested change
| description = Post().getShortDescription(this.post) | |
| description = this.post.getShortDescription() |
Comment on lines
+30
to
+32
| const delimiter = '<hr>' | ||
|
|
||
| if ($routeParams && !$routeParams.id && this.post.body.includes(delimiter)) { |
Owner
There was a problem hiding this comment.
Suggested change
| const delimiter = '<hr>' | |
| if ($routeParams && !$routeParams.id && this.post.body.includes(delimiter)) { | |
| if ($routeParams && !$routeParams.id) { |
Comment on lines
+171
to
+175
| getShortDescription: function (post) { | ||
| const delimiter = '<hr>' | ||
| return post.body.substring(0, post.body.indexOf(delimiter)); | ||
| } | ||
| }; |
Owner
There was a problem hiding this comment.
Suggested change
| getShortDescription: function (post) { | |
| const delimiter = '<hr>' | |
| return post.body.substring(0, post.body.indexOf(delimiter)); | |
| } | |
| }; | |
| getShortDescription: function () { | |
| const delimiter = '<hr>' | |
| return this.body.substring(0, this.body.indexOf(delimiter)); | |
| } | |
| }; |
xepozz
approved these changes
Aug 7, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cut hr and br tags from descriptions