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

Article ratings reducers and implementation #98

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ibraheemkabir
Copy link
Contributor

##What does this PR do.
This PR implements the articles rating functionality.

##Tasks to be carried implemented.

  • This PR displays the average rating of articles on all relevant views
  • This PR also enables users to rate articles based when they read.
    -It also ensures that users are not able to rate articles they have not read.

##relevant PT stories
#162414125

const isLoggedIn = this.isLoggedIn();
const user = getUserIdFromLocalStorage();
const { title } = this.props.match.params;
const rating = this.props.userRating.successResponse;

Choose a reason for hiding this comment

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

'userRating' is missing in props validation react/prop-types
'userRating.successResponse' is missing in props validation react/prop-types

const { title } = this.props.match.params;
const userId = getUserIdFromLocalStorage();
if (userId) {
this.props.getUserArticleRating(title);

Choose a reason for hiding this comment

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

'getUserArticleRating' is missing in props validation react/prop-types

</Fragment>
);
class ViewArticle extends Component {
isLoggedIn = () => {

Choose a reason for hiding this comment

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

isLoggedIn should be placed after componentWillMount react/sort-comp

}

render() {
const { id, ratingIcon, numberofcomments, date, name, rating, disabled } = this.props;

Choose a reason for hiding this comment

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

'id' is missing in props validation react/prop-types
'numberofcomments' is assigned a value but never used no-unused-vars

articleId: this.props.selectedArticleId,
rating
};
this.props.createArticleRating(ratingDetails);

Choose a reason for hiding this comment

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

'createArticleRating' is missing in props validation react/prop-types


handleRate = (e, { rating }) => {
const ratingDetails = {
reviewerId: this.props.user,

Choose a reason for hiding this comment

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

'user' is missing in props validation react/prop-types

@@ -87,6 +91,7 @@ ReadArticle.propTypes = {
featuredImageUrl: PropTypes.string,
articleAuthor: PropTypes.object,
getArticle: PropTypes.func.isRequired,
getUserArticleRating: PropTypes.func.isRequired,

Choose a reason for hiding this comment

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

'getUserArticleRating' PropType is defined but prop is never used react/no-unused-prop-types

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.

2 participants