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

#165273492 Add user create report of article functionality #27

Merged
merged 1 commit into from
May 8, 2019

Conversation

KabohaJeanMark
Copy link
Contributor

@KabohaJeanMark KabohaJeanMark commented May 6, 2019

What does this PR do?
It enables authenticated users to report articles which

Description of tasks to be completed

  • An authenticated user can report articles
  • An article cannot be reported more than once
  • Only the admin has the permission to view the reported articles

Endpoints
POST api/article/<article_id>/report Report a specific article by its id. Authenticated user access
GET api/article/reports/ Get all articles that have been reported. Only admin access

How to test this PR

Expected request body for a post

{
	"report": {
		"reason": "Plagiarism and refusal to admit sources of intellectual property"
	}
}

Expected body for a response

{
    "report": {
        "id": 2,
        "reason": "Plagiarism and refusal to admit sources of intellectual property",
        "date_reported": "2019-05-06T15:42:37.157955Z",
        "article": 2,
        "reporter": "marcus"
    },
    "message": "Report successfully created."
}

If a person tries to report the same article twice, the expected response body is

{
    "error": "You already reported this article"
}

To view all reports of articles
GET api/articles/reports/

Screen Shot 2019-05-06 at 8 21 03 PM

#165273492

@KabohaJeanMark KabohaJeanMark force-pushed the ft-user-report-articles-165273492 branch 2 times, most recently from 81d20ae to 4bf8067 Compare May 6, 2019 17:28
@KabohaJeanMark KabohaJeanMark force-pushed the ft-user-report-articles-165273492 branch from 4bf8067 to 8c4e397 Compare May 6, 2019 17:47
@KabohaJeanMark KabohaJeanMark force-pushed the ft-user-report-articles-165273492 branch 2 times, most recently from e7a2974 to f1a3e4f Compare May 7, 2019 08:18
@joelmugaya joelmugaya temporarily deployed to inviticus-staging-pr-27 May 7, 2019 08:31 Inactive
@KabohaJeanMark KabohaJeanMark force-pushed the ft-user-report-articles-165273492 branch from f1a3e4f to 852530c Compare May 7, 2019 09:27
@joelmugaya joelmugaya temporarily deployed to inviticus-staging-pr-27 May 7, 2019 09:27 Inactive
Copy link
Contributor

@mwinel mwinel left a comment

Choose a reason for hiding this comment

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

As per the implementation requirements on the PT board, this LGTM. It is ready for a merge.

@KabohaJeanMark KabohaJeanMark force-pushed the ft-user-report-articles-165273492 branch 2 times, most recently from 422892d to ecd0450 Compare May 8, 2019 05:54
@joelmugaya joelmugaya requested a deployment to inviticus-staging-pr-27 May 8, 2019 07:24 Abandoned
@joelmugaya joelmugaya temporarily deployed to inviticus-staging-pr-27 May 8, 2019 07:24 Inactive
@KabohaJeanMark KabohaJeanMark force-pushed the ft-user-report-articles-165273492 branch from ecd0450 to 7c791ad Compare May 8, 2019 11:32
@KabohaJeanMark KabohaJeanMark temporarily deployed to inviticus-staging-pr-27 May 8, 2019 11:32 Inactive
- Modify article table
- Create model for reports
- Create view function for adding a report to an article
- Add logic to prevent the same user reporting on an article more than once

[Starts: #165273492]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants