added hint on notification settings to combined message

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-01-27 19:53:38 +01:00
parent c40224f572
commit a878cae395
4 changed files with 21 additions and 9 deletions

View File

@@ -225,6 +225,8 @@ public class MessageSystem extends BaseHandler implements PostBox, EventListener
try {
var envelopes = queue.getEnvelopesFor(receiver);
envelopes.stream().map(Envelope::message).forEach(combined::merge);
if (receiver instanceof UmbrellaUser) combined.addNote();
send(combined,date);
envelopes.forEach(env -> queue.markRead(env.id(),receiver));
} catch (Exception ex){

View File

@@ -1,7 +1,9 @@
/* © SRSoftware 2025 */
package de.srsoftware.umbrella.message.model;
import static de.srsoftware.umbrella.core.ModuleRegistry.translator;
import static de.srsoftware.umbrella.core.Util.dateTimeOf;
import static de.srsoftware.umbrella.core.model.Translatable.t;
import static java.lang.System.Logger.Level.DEBUG;
import static java.lang.System.Logger.Level.TRACE;
import static java.text.MessageFormat.format;
@@ -20,6 +22,7 @@ public class CombinedMessage {
private final List<Message<?>> mergedMessages = new ArrayList<>();
private final Translatable subjectForCombinedMessage;
private UmbrellaUser sender = null;
public static final String SEPARATOR = "\n\n━━━━━━━━━━━━━━━━━━━━━\n\n";
public CombinedMessage(Translatable subjectForCombinedMessage, User receiver){
LOG.log(DEBUG,"Creating combined message for {0}…",receiver);
@@ -28,6 +31,19 @@ public class CombinedMessage {
this.lang = receiver.language();
}
public void addNote() {
var text = translator().translate(lang,"You may change your notification settings at {base_url}/message/settings");
combinedBody.append(SEPARATOR).append(text);
}
public Set<Attachment> attachments() {
return attachments;
}
public String body() {
return combinedBody.toString();
}
public void merge(Message<?> message) {
LOG.log(TRACE,"Merging {0} into combined message…",message);
@@ -45,21 +61,13 @@ public class CombinedMessage {
combinedSubject = subjectForCombinedMessage.translate(lang);
// no break here, we need to append the subject and content
default:
combinedBody.append("\n\n━━━━━━━━━━━━━━━━━━━━━\n\n# ").append(message.sender()).append(" @ ").append(dateTimeOf(message.utcTime())).append("\n→ ").append(subject).append(":\n\n");
combinedBody.append(SEPARATOR).append("# ").append(message.sender()).append(" @ ").append(dateTimeOf(message.utcTime())).append("\n→ ").append(subject).append(":\n\n");
combinedBody.append(body);
}
if (message.attachments() != null) attachments.addAll(message.attachments());
mergedMessages.add(message);
}
public Set<Attachment> attachments() {
return attachments;
}
public String body() {
return combinedBody.toString();
}
public List<Message<?>> messages() {
return mergedMessages;
}

View File

@@ -431,6 +431,7 @@
"You can view/edit this task at {base_url}/task/{id}/view": "Du kannst diese Aufgabe unter {base_url}/task/{id}/view ansehen/bearbeiten.",
"You can view/edit this wiki page at {base_url}/wiki/{id}/view": "Du kannst diese Wiki-Seite unter {base_url}/wiki/{id}/view ansehen/bearbeiten.",
"You have been added to the new project '{project}', created by {user}:\n\n{body}": "Du wurdest zum neuen Projekt '{project}', angelegt von {user}, hinzugefügt:\n\n{body}",
"You may change your notification settings at {base_url}/message/settings": "Du kannst deine Benachrichtigungseinstellungen unter {base_url}/message/settings ändern.",
"Your token to create a new password" : "Ihr Token zum Erstellen eines neuen Passworts",
"your_profile": "dein Profil"
}

View File

@@ -431,6 +431,7 @@
"You can view/edit this task at {base_url}/task/{id}/view": "You can view/edit this task at {base_url}/task/{id}/view",
"You can view/edit this wiki page at {base_url}/wiki/{id}/view": "You can view/edit this wiki page at {base_url}/wiki/{id}/view",
"You have been added to the new project '{project}', created by {user}:\n\n{body}": "You have been added to the new project '{project}', created by {user}:\n\n{body}",
"You may change your notification settings at {base_url}/message/settings": "You may change your notification settings at {base_url}/message/settings .",
"Your token to create a new password" : "Your token to create a new password",
"your_profile": "your profile"
}