Skip to content
Snippets Groups Projects
Commit 6eb2d7da authored by srosse's avatar srosse
Browse files

Merge remote-tracking branch 'origin/OpenOLAT_15.2' into OpenOLAT_15.3

parents 9bbb1d44 fd08e60c
No related branches found
Tags OpenOLAT_15.2.8
No related merge requests found
Showing
with 28 additions and 1 deletion
......@@ -34,6 +34,8 @@ import java.util.Locale;
import org.apache.logging.log4j.Logger;
import org.olat.core.commons.modules.bc.FileInfo;
import org.olat.core.commons.modules.bc.FolderManager;
import org.olat.core.commons.services.doceditor.DocEditor;
import org.olat.core.commons.services.doceditor.DocEditor.Mode;
import org.olat.core.commons.services.notifications.NotificationHelper;
import org.olat.core.commons.services.notifications.NotificationsHandler;
import org.olat.core.commons.services.notifications.NotificationsManager;
......@@ -44,6 +46,7 @@ import org.olat.core.commons.services.notifications.manager.NotificationsUpgrade
import org.olat.core.commons.services.notifications.model.SubscriptionListItem;
import org.olat.core.commons.services.notifications.model.TitleItem;
import org.olat.core.commons.services.vfs.VFSMetadata;
import org.olat.core.commons.services.vfs.VFSVersionModule;
import org.olat.core.gui.translator.Translator;
import org.olat.core.gui.util.CSSHelper;
import org.olat.core.id.context.BusinessControlFactory;
......@@ -78,6 +81,10 @@ public class FolderNotificationsHandler implements NotificationsHandler {
private NotificationsManager notificationsManager;
@Autowired
private BusinessGroupService businessGroupService;
@Autowired
private VFSVersionModule versionModule;
@Autowired
private List<DocEditor> editors;
@Override
public SubscriptionInfo createSubscriptionInfo(final Subscriber subscriber, Locale locale, Date compareDate) {
......@@ -125,7 +132,11 @@ public class FolderNotificationsHandler implements NotificationsHandler {
Long identityKey = fi.getAuthorIdentityKey();
Date modDate = fi.getLastModified();
String desc = translator.translate("notifications.entry", new String[] { title, NotificationHelper.getFormatedName(identityKey) });
// Documents may be edited with a document editor, so author is not the modifier
boolean anonymous = versionModule.getMaxNumberOfVersions() < 1 && hasDocumentEditor(fi.getMetaInfo());
String desc = anonymous
? translator.translate("notifications.entry.anonymous", new String[] { title })
: translator.translate("notifications.entry", new String[] { title, NotificationHelper.getFormatedName(identityKey) });
String urlToSend = null;
String businessPath = null;
if(p.getBusinessPath() != null) {
......@@ -146,6 +157,15 @@ public class FolderNotificationsHandler implements NotificationsHandler {
return si;
}
private boolean hasDocumentEditor(VFSMetadata metaInfo) {
String suffix = FileUtils.getFileSuffix(metaInfo.getFilename());
return editors.stream()
.filter(DocEditor::isEnable)
.filter(editor -> editor.isSupportingFormat(suffix, Mode.EDIT, true))
.findFirst()
.isPresent();
}
private void checkPublisher(Publisher p) {
try {
if("BusinessGroup".equals(p.getResName())) {
......
#Mon Mar 02 09:54:04 CET 2009
notifications.entry=Datei "{0}" von {1} ver\u00E4ndert
notifications.entry.anonymous=Datei "{0}" ver\u00E4ndert
notifications.header=In einem von Ihnen abonnierten Ordner befinden sich neue Dateien\:
notifications.header.course=Ordner in Kurs "{0}"
notifications.header.group=Ordner in Gruppe "{0}"
#Sun Aug 15 17:55:18 CEST 2010
notifications.entry=File "{0}" altered by {1}
notifications.entry.anonymous=File "{0}" altered
notifications.header=There are new files in a folder to which you subscribed\:
notifications.header.course=Folder in course "{0}"
notifications.header.group=Folder in group "{0}"
#Tue Feb 09 01:33:27 CET 2010
notifications.entry=Fichier "{0}" modifi\u00E9 par {1}
notifications.entry.anonymous=Fichier "{0}" modifi\u00E9
notifications.header=Dans un de vos dossiers abonn\u00E9s se trouvent de nouveaux fichiers\:
notifications.header.course=Dossier dans le cours "{0}"
notifications.header.group=Dossier dans le groupe "{0}"
#Thu Jun 17 15:44:21 CEST 2010
notifications.entry=File "{0}" modificato da {1}
notifications.entry.anonymous=File "{0}" modificato
notifications.header=In una cartella da Lei abbonata si trovano nuovi file\:
notifications.header.course=Cartella nel corso "{0}"
notifications.header.group=Cartella nel gruppo "{0}"
#Thu Sep 08 16:42:46 CEST 2011
notifications.entry=Bestand "{0}" aangepast door {1}
notifications.entry.anonymous=Bestand "{0}" aangepast
notifications.header=Er zijn nieuwe bestanden in een map waarvoor u ingeschreven bent\:
notifications.header.course=Map in cursus "{0}"
notifications.header.group=Map in groep "{0}"
#Sun Mar 14 22:29:30 CET 2010
notifications.entry=Plik "{0}" zmieniony przez {1}
notifications.entry.anonymous=Plik "{0}" zmieniony
notifications.header=S\u0105 nowe pliki w folderze, kt\u00F3ry subskrybujesz\:
notifications.header.course=Folder w kursie "{0}"
notifications.header.group=Folder w grupie "{0}"
#Wed Jun 09 14:44:22 CEST 2010
notifications.entry=Arquivo "{0}" alterados por {1}
notifications.entry.anonymous=Arquivo "{0}" alterados
notifications.header=H\u00E1 novos arquivos em uma pasta \u00E0 qual voc\u00EA se inscreveu\:
notifications.header.course=Pasta no curso "{0}"
notifications.header.group=Pasta no grupo "{0}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment