Skip to content
Snippets Groups Projects
Commit 0781a23d authored by srosse's avatar srosse
Browse files

OO-1483: use the same way to compose the full name of authors and modifiers in blog and podcast

parent f2d3d970
No related branches found
No related tags found
No related merge requests found
...@@ -22,13 +22,8 @@ package org.olat.modules.webFeed.models; ...@@ -22,13 +22,8 @@ package org.olat.modules.webFeed.models;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import org.olat.basesecurity.BaseSecurityManager;
import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.controllers.navigation.Dated; import org.olat.core.commons.controllers.navigation.Dated;
import org.olat.core.gui.components.form.flexible.elements.FileElement; import org.olat.core.gui.components.form.flexible.elements.FileElement;
import org.olat.core.id.Identity;
import org.olat.core.id.User;
import org.olat.core.id.UserConstants;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.user.UserManager; import org.olat.user.UserManager;
...@@ -140,15 +135,7 @@ public class Item implements Serializable, Dated { ...@@ -140,15 +135,7 @@ public class Item implements Serializable, Dated {
public String getAuthor() { public String getAuthor() {
String authorName = null; String authorName = null;
if(authorKey > 0) { if(authorKey > 0) {
Identity identity = BaseSecurityManager.getInstance().loadIdentityByKey(authorKey, false); authorName = UserManager.getInstance().getUserDisplayName(authorKey);
if (identity != null) {
User user = identity.getUser();
if (user == null) {
authorName = author = identity.getName();
} else {
authorName = author = user.getProperty(UserConstants.FIRSTNAME, null) + " " + user.getProperty(UserConstants.LASTNAME, null);
}
}
} }
if (authorName == null && StringHelper.containsNonWhitespace(author)) { if (authorName == null && StringHelper.containsNonWhitespace(author)) {
authorName = author; authorName = author;
...@@ -173,15 +160,7 @@ public class Item implements Serializable, Dated { ...@@ -173,15 +160,7 @@ public class Item implements Serializable, Dated {
public String getModifier() { public String getModifier() {
String modifierName = null; String modifierName = null;
if(modifierKey > 0) { if(modifierKey > 0) {
Identity identity = BaseSecurityManager.getInstance().loadIdentityByKey(modifierKey, false); modifierName = UserManager.getInstance().getUserDisplayName(modifierKey);
if (identity != null) {
User user = identity.getUser();
if (user == null) {
modifierName = modifier = identity.getName();
} else {
modifierName = modifier = CoreSpringFactory.getImpl(UserManager.class).getUserDisplayName(identity);
}
}
} }
if (modifierName == null && StringHelper.containsNonWhitespace(modifier)) { if (modifierName == null && StringHelper.containsNonWhitespace(modifier)) {
modifierName = modifier; modifierName = modifier;
......
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