Conversation
Greptile SummaryThis PR simplifies the MMS attachment model across the full stack — replacing the Key changes:
Two bugs need to be addressed before merging:
A softer concern: the Discord handler no longer forwards Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant API as httpSMS API
participant FCM as FirebaseMessagingService
participant HttpSvc as HttpSmsApiService
participant Carrier as MMS Carrier
API->>FCM: Push notification (Message with attachments: []string)
FCM->>FCM: handleMmsMessage(message)
loop For each attachment URL
FCM->>HttpSvc: downloadAttachment(context, url, messageId, index)
HttpSvc->>HttpSvc: GET url (OkHttp)
HttpSvc-->>FCM: Pair<File, MediaType> (or Pair<null,null> on failure)
FCM->>FCM: extractFileName(url, index, mimeType)
end
FCM->>FCM: Build PduBody (text part + media parts with real MediaType)
FCM->>FCM: PduComposer.make() → pduBytes
FCM->>Carrier: sendMultimediaMessage(pduUri)
Carrier-->>FCM: Sent broadcast
FCM->>API: POST /v1/messages/{id}/events (sent)
|
There was a problem hiding this comment.
Pull request overview
This PR updates MMS attachment handling across the httpSMS stack by changing attachments from {content_type, url} objects to plain URL strings, adjusting validation/storage accordingly, and updating the UI/mobile rendering/sending behavior.
Changes:
- Web: send and display attachments as URL strings (links) instead of typed attachment objects.
- API: change request/service/event/entity attachment types to
[]string, add a custom validator rule for attachment URLs. - Android: update message model + MMS send flow to download attachments and use the server-provided content type.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| web/pages/threads/_id/index.vue | Render attachments as clickable URL links in the thread view. |
| web/pages/messages/index.vue | Send attachments to the API as a trimmed string[] instead of {content_type,url} objects; update page title casing. |
| web/models/message.ts | Update Message.attachments type to string[] | null. |
| api/pkg/validators/validator.go | Add multipleAttachmentURL validation rule for []string attachment URLs. |
| api/pkg/validators/message_handler_validator.go | Apply attachment URL validation rules to send/bulk-send requests; remove prior per-attachment checks. |
| api/pkg/services/message_service.go | Update MessageSendParams.Attachments type to []string. |
| api/pkg/requests/message_send_request.go | Change attachments field to []string and sanitize/trim attachments. |
| api/pkg/requests/message_bulk_send_request.go | Change bulk-send attachments field to []string and sanitize/trim attachments; mark encrypted as optional. |
| api/pkg/requests/bulk_message_request.go | Sanitize comma-separated attachment URLs; pass attachments into MessageSendParams. |
| api/pkg/handlers/discord_handler.go | Remove parsing/surfacing of Discord attachment_urls into the send request. |
| api/pkg/events/message_api_sent_event.go | Change event payload attachments type to []string. |
| api/pkg/entities/message.go | Change persisted Message.Attachments storage to pq.StringArray (text[]). |
| android/app/src/main/java/com/httpsms/Models.kt | Update Message.attachments model to List<String>?. |
| android/app/src/main/java/com/httpsms/HttpSmsApiService.kt | Return (File, MediaType) info when downloading attachments; enforce max size constant. |
| android/app/src/main/java/com/httpsms/FirebaseMessagingService.kt | Build MMS parts using downloaded file + detected content type; improve filenames; adjust cleanup. |
| android/app/src/main/java/com/httpsms/Constants.kt | Introduce MAX_MMS_ATTACHMENT_SIZE constant. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.