Skip to content

Commit

Permalink
Fix bug where messages didn't send because recipients weren't strings
Browse files Browse the repository at this point in the history
ephraimkunz committed Sep 20, 2024
1 parent d68f7af commit d296beb
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion StudentOutreach/Models/CanvasTypes.swift
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ struct Assignment: Decodable, Identifiable, Hashable {
}

struct PostMessageData: Encodable {
let recipients: [Int]
let recipients: [String]
let subject: String
let body: String
let contextCode: String
4 changes: 2 additions & 2 deletions StudentOutreach/Models/Networking.swift
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@ struct Networking {
request.httpMethod = "POST"

request.setValue("application/json", forHTTPHeaderField:"Content-Type");
let postData = PostMessageData(recipients: recipients.map({ $0.id }), subject: subject, body: body, contextCode: contextCode)
let postData = PostMessageData(recipients: recipients.map({ String($0.id) }), subject: subject, body: body, contextCode: contextCode)

do {
let data = try encoder.encode(postData);
@@ -187,7 +187,7 @@ struct Networking {
request.httpMethod = "POST"

request.setValue("application/json", forHTTPHeaderField:"Content-Type");
let postData = PostMessageData(recipients: [recipient.id], subject: subject, body: body, contextCode: contextCode)
let postData = PostMessageData(recipients: [String(recipient.id)], subject: subject, body: body, contextCode: contextCode)

do {
let data = try encoder.encode(postData);

0 comments on commit d296beb

Please sign in to comment.