instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.45k stars 2.44k forks source link

subject ignored when using api/v1/courses/<id>/quizzes/<quiz id>/submission_users/message #2104

Open norwood867 opened 1 year ago

norwood867 commented 1 year ago

Summary:

subject not used when using api/v1/courses//quizzes/<quiz id?/submission_users/message

Steps to reproduce:

  1. import requests from api_key import api_key as api_key

    url = "https://clpccd.instructure.com/api/v1/courses/21867/quizzes/379300/submission_users/message" header = api_key data = {'conversations[body]': 'test using python requests', 'conversations[subject]': 'new this is a test 20221001_2', 'conversations[recipients]': 'all'}

    r = requests.post(url=url, headers=header, data=data)

Expected behavior:

The subject of the message is set to 'new this is a test 20221001_2'

Actual behavior:

The subject is not set. This can be seen in both the UI and the email notification shown below:

"{"type"=>"string", "description"=>"Subject of the new Conversation created", "example"=>"ATTN: Quiz 101 Students"} test using python requests"

Additional notes:

After more research, I found that a new conversation might be associated with an existing conversation, and when that happens, the 'Subject' is ignored. A new conversation can be forced not to be associated with an existing conversation by using the force_new=True. However, this seems to be ignored when passed with a submission_users/message.

The way conversations (what I think of as messages) work is not intuitive. Sending messages to students who haven't submitted a quiz without adding a new subject, possibly allowing it to be grouped with unrelated messages, seems to be an issue.

Working on this made me realize that when in the UI, the "send messages to..." students as a reminder to take the quiz, the message doesn't have a subject and then gets mixed with other conversations without something in the body indicating it is for the quiz.