Skip to content

Commit

Permalink
[#457] Additional fix: Truncate the post body to 250 characters withi…
Browse files Browse the repository at this point in the history
…n the notification (#480)

* Include sender, post content and action in group post notification body [#457]
Send post notification only to the creator of the post [#372]

* [#457] Additional fix: Truncate the post body to 250 characters within the notification
  • Loading branch information
mdryankov authored Jul 16, 2024
1 parent cd478d3 commit 982ef82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed
### Fixed
- Additional fix: Truncate the post body to 250 characters within the notification[#457](https://github.com/rokwire/groups-building-block/issues/457)

## [1.46.1] - 2024-07-11
### Fixed
- Do not send polls and direct message notifications as muted when they are not [#477](https://github.com/rokwire/groups-building-block/issues/477)
Expand Down
7 changes: 6 additions & 1 deletion core/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ func (app *Application) sendGroupNotificationForNewPost(clientID string, current
if group.ResearchGroup {
groupStr = "Research Project"
}

title := fmt.Sprintf("%s - %s", groupStr, group.Title)
operation := "messaged you"
if len(post.ToMembersList) == 0 {
Expand All @@ -554,7 +555,11 @@ func (app *Application) sendGroupNotificationForNewPost(clientID string, current
currentUserName = &val
}

body := fmt.Sprintf("%s %s '%s'", *currentUserName, operation, post.Body)
notificationBody := post.Body
if len(notificationBody) > 250 {
notificationBody = notificationBody[:250] + "..."
}
body := fmt.Sprintf("%s %s \"%s\"", *currentUserName, operation, notificationBody)
if post.UseAsNotification {
title = post.Subject
body = post.Body
Expand Down

0 comments on commit 982ef82

Please sign in to comment.