This is an automated email from the ASF dual-hosted git repository. solomax pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push: new 46b55ae [OPENMEETINGS-2458] display name is being used where appropriate 46b55ae is described below commit 46b55ae74d42dd5d934bcfa1180bd70a6c863f34 Author: Maxim Solodovnik <solomax...@gmail.com> AuthorDate: Mon Sep 28 07:43:46 2020 +0700 [OPENMEETINGS-2458] display name is being used where appropriate --- .../java/org/apache/openmeetings/db/entity/user/User.java | 12 ++++++++---- .../org/apache/openmeetings/web/room/poll/VoteDialog.java | 14 ++++---------- .../openmeetings/web/user/profile/UserSearchPanel.java | 6 +----- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java index a1f7c82..05388a3 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java @@ -664,8 +664,8 @@ public class User extends HistoricalEntity { StringBuilder sb = new StringBuilder(); String delim = ""; OmLanguage l = LabelDao.getLanguage(languageId); - String first = l.isRtl() ? getLastname() : getFirstname(); - String last = l.isRtl() ? getFirstname() : getLastname(); + String first = l.isRtl() ? lastname : firstname; + String last = l.isRtl() ? firstname : lastname; if (!Strings.isEmpty(first)) { sb.append(first); delim = " "; @@ -673,8 +673,12 @@ public class User extends HistoricalEntity { if (!Strings.isEmpty(last)) { sb.append(delim).append(last); } - if (Strings.isEmpty(sb) && address != null && !Strings.isEmpty(address.getEmail())) { - sb.append(delim).append(address.getEmail()); + if (Strings.isEmpty(sb)) { + if (Type.CONTACT == type && address != null && !Strings.isEmpty(address.getEmail())) { + sb.append(address.getEmail()); + } else { + sb.append(login); + } } if (Strings.isEmpty(sb)) { sb.append(DISPLAY_NAME_NA); diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java index 0bea815..94129cd 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java @@ -61,7 +61,7 @@ public class VoteDialog extends Modal<RoomPollAnswer> { private static final List<Integer> answers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); private PollAnswerForm form; private final NotificationPanel feedback = new NotificationPanel("feedback"); - private final IModel<String> user = Model.of((String)null); + private final Label userLbl = new Label("user", Model.of("")); @SpringBean private UserDao userDao; @SpringBean @@ -104,7 +104,7 @@ public class VoteDialog extends Modal<RoomPollAnswer> { } static String getName(Component c, User u) { - return u == null ? "" : (getUserId().equals(u.getId()) ? c.getString("1411") : u.getFirstname() + " " + u.getLastname()); + return u == null ? "" : (getUserId().equals(u.getId()) ? c.getString("1411") : u.getDisplayName()); } public void updateModel(IPartialPageRequestHandler target, RoomPoll rp) { @@ -112,7 +112,7 @@ public class VoteDialog extends Modal<RoomPollAnswer> { a.setRoomPoll(rp); User u = userDao.get(getUserId()); a.setVotedUser(u); - user.setObject(getName(this, a.getRoomPoll().getCreator())); + userLbl.setDefaultModelObject(getName(this, a.getRoomPoll().getCreator())); form.setModelObject(a); boolean typeNum = a.getRoomPoll() != null && RoomPoll.Type.NUMERIC == a.getRoomPoll().getType(); form.typeBool.setVisible(!typeNum); @@ -120,12 +120,6 @@ public class VoteDialog extends Modal<RoomPollAnswer> { target.add(form); } - @Override - protected void onDetach() { - user.detach(); - super.onDetach(); - } - private class PollAnswerForm extends Form<RoomPollAnswer> { private static final long serialVersionUID = 1L; private final WebMarkupContainer typeBool = new WebMarkupContainer("typeBool"); @@ -139,7 +133,7 @@ public class VoteDialog extends Modal<RoomPollAnswer> { protected void onInitialize() { super.onInitialize(); add(feedback.setOutputMarkupId(true)); - add(new Label("user", user)); + add(userLbl); add(new Label("roomPoll.question")); add(typeBool.add(new RadioGroup<Boolean>("answer").setRequired(true) .add(new Radio<>("true", Model.of(Boolean.TRUE))).add(new Radio<>("false", Model.of(Boolean.FALSE))) diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java index 04a47af..94afde3 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java @@ -117,7 +117,7 @@ public class UserSearchPanel extends UserBasePanel { User u = item.getModelObject(); final long userId = u.getId(); item.add(new WebMarkupContainer("status").add(AttributeModifier.append(ATTR_CLASS, cm.isOnline(userId) ? "online" : "offline"))); - item.add(new Label("name", getName(u))); + item.add(new Label("name", u.getDisplayName())); item.add(new Label("tz", getTimeZone(u).getID())); item.add(new Label("offer", u.getUserOffers())); item.add(new Label("search", u.getUserSearchs())); @@ -147,10 +147,6 @@ public class UserSearchPanel extends UserBasePanel { handler.appendJavaScript("$('#searchUsersTable .invite.om-icon.clickable').off().click(function() {inviteUser($(this).data('user-id'));});"); } - private static String getName(User u) { - return "" + u.getFirstname() + " " + u.getLastname() + " [" + u.getLogin() + "]"; - } - @Override public void onNewMessageClose(IPartialPageRequestHandler handler) { refresh(handler);