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

Truncate Message' Subject if it's longer than 998 characters #1704

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

KevinBoulongne
Copy link
Contributor

No description provided.

@KevinBoulongne KevinBoulongne added the bug Something isn't working label Feb 16, 2024
@KevinBoulongne KevinBoulongne requested a review from a team as a code owner February 16, 2024 09:43
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@@ -633,6 +633,7 @@ class NewMessageViewModel @Inject constructor(
private fun saveDraftToLocal(action: DraftAction) {
SentryLog.d("Draft", "Save Draft to local")

draft.subject?.takeIf { it.length > SUBJECT_MAX_LENGTH }?.let { draft.subject = it.substring(0, SUBJECT_MAX_LENGTH) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
draft.subject?.takeIf { it.length > SUBJECT_MAX_LENGTH }?.let { draft.subject = it.substring(0, SUBJECT_MAX_LENGTH) }
draft.subject = draft.subject?.take(SUBJECT_MAX_LENGTH)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@KevinBoulongne KevinBoulongne merged commit 97819a4 into master Feb 16, 2024
3 checks passed
@KevinBoulongne KevinBoulongne deleted the subject-max-length branch February 16, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants