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

feat: upgrading simple api to drf compatible ( 3rd api ) list_email_content #35111

Merged
merged 9 commits into from
Aug 22, 2024

Conversation

awais786
Copy link
Contributor

@awais786 awais786 commented Jul 11, 2024

Issue: #35112

existing API Code

Updating api code using DRF.

  1. Added standard authentication_classes
  2. Added permission_classes

Steps to verify on local tutor instance:
1: Open admin panel and laod this page and enable both checkboxes and save.
2: Open this page and enter course id and enabled email.
3. Open instructor dashboard.
4. email tab is visible and click on that and further click new experience.
5. Send an email email now.
6. Click on Email Task History now it will hit the related API.

Screenshot 2024-07-31 at 12 33 34 PM

Steps to verify via postman.

  1. Pass the URL in postman.
  2. Pass required csrf token and access token.

expected result

{
    "emails": [
        {
            "created": "2024-07-31T07:20:30.293Z",
            "sent_to": [
                "Myself"
            ],
            "requester": "admin",
            "email": {
                "subject": "awa",
                "html_message": "<p>aaaa</p>",
                "id": "2"
            },
            "number_sent": "1 sent"
        },
        {
            "created": "2024-07-31T07:17:50.419Z",
            "sent_to": [
                "Myself",
                "All students"
            ],
            "requester": "admin",
            "email": {
                "subject": "awais",
                "html_message": "<p>THis is not a <strong>ways</strong></p>",
                "id": "1"
            },
            "number_sent": "2 sent"
        }
    ]
}

@awais786 awais786 changed the title feat: upgrading simple api to drf compatible. feat: upgrading simple api to drf compatible ( 3rd api ) Jul 31, 2024
@awais786 awais786 requested a review from feanil July 31, 2024 09:57
@awais786 awais786 closed this Jul 31, 2024
@awais786 awais786 reopened this Jul 31, 2024
@awais786 awais786 marked this pull request as ready for review August 7, 2024 13:02
Copy link
Member

@UsamaSadiq UsamaSadiq left a comment

Choose a reason for hiding this comment

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

Looks good to be merged.

@awais786 awais786 changed the title feat: upgrading simple api to drf compatible ( 3rd api ) feat: upgrading simple api to drf compatible ( 3rd api ) list_email_content Aug 7, 2024
@awais786
Copy link
Contributor Author

awais786 commented Aug 9, 2024

@feanil Please review.

Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

Looks great and I tested that the API works.

@@ -2165,23 +2165,35 @@ def list_background_email_tasks(request, course_id):
return JsonResponse(response_payload)


@require_POST
Copy link
Contributor

Choose a reason for hiding this comment

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

It's confusing that this is a POST request in the first place given that it is not sending any data in the POST body and not making any modifications. But that change was made in #12719 for reasons that are unclear to us now so we'll leave it as is for now and we can re-visit if/when we want to revamp the instructor APIs further.

This will at-least make these APIs all visible in our openapi spec and make the APIs usable by other token types than just session.

(Not something you need to do anything about, just leaving a not for future investigators.)

@awais786 awais786 merged commit f93d16f into master Aug 22, 2024
49 checks passed
@awais786 awais786 deleted the list_email_content-drf branch August 22, 2024 08:37
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

rediris pushed a commit to gymnasium/edx-platform that referenced this pull request Aug 27, 2024
…ontent (openedx#35111)

* feat: upgrading simple api to drf compatible.
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.

4 participants