fixed bug allowing to set unread messeages already unread
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/message-conversations@182160 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fd855668cf
commit
7f439d7eb5
|
@ -18,6 +18,7 @@ import com.google.gwt.uibinder.client.UiBinder;
|
|||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.Random;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
@ -61,7 +62,7 @@ public class MessageItem extends Composite {
|
|||
@UiField MaterialDropDown dd;
|
||||
|
||||
MessagesResources images = GWT.create(MessagesResources.class);
|
||||
|
||||
|
||||
|
||||
public MessageItem(final ConvMessage m, MaterialCollection parentCollection, ApplicationView ap, boolean sent) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
@ -74,9 +75,10 @@ public class MessageItem extends Composite {
|
|||
attachmentsIcon.setVisibility(Visibility.VISIBLE);
|
||||
if (!sent && !m.isRead())
|
||||
item.addStyleName("unread-message");
|
||||
if (sent)
|
||||
if (sent || !myMessage.isRead()) {
|
||||
dd.remove(0); //remove the option to set unread if the message is sent
|
||||
|
||||
}
|
||||
|
||||
if (m.getOwner().getAvatarURL() == null || m.getOwner().getAvatarURL().compareTo("")== 0) {
|
||||
if (sent)
|
||||
avatarImage.setResource(
|
||||
|
@ -98,7 +100,7 @@ public class MessageItem extends Composite {
|
|||
timeLabel.setText(Utils.getFormatteDate(m.getDate()));
|
||||
if (sent)
|
||||
item.setBackgroundColor(Color.WHITE);
|
||||
|
||||
|
||||
//because on tablet and on mobile cause problems
|
||||
if (!Utils.isMobile()) {
|
||||
item.addMouseOverHandler(new MouseOverHandler() {
|
||||
|
@ -149,14 +151,18 @@ public class MessageItem extends Composite {
|
|||
dd.setActivator(activator);
|
||||
messageActionIcon.setActivates(activator);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@UiHandler("setUnreadButton")
|
||||
void onSetUnread(ClickEvent e) {
|
||||
e.stopPropagation();
|
||||
ap.setMessageUnread(myMessage, this.sent);
|
||||
myMessage.setRead(false);
|
||||
item.addStyleName("unread-message");
|
||||
if (myMessage.isRead()) {
|
||||
ap.setMessageUnread(myMessage, this.sent);
|
||||
myMessage.setRead(false);
|
||||
item.addStyleName("unread-message");
|
||||
} else {
|
||||
Window.alert("Message is marked as unread already.");
|
||||
}
|
||||
}
|
||||
|
||||
private void doDelete(String subject) {
|
||||
|
@ -187,7 +193,7 @@ public class MessageItem extends Composite {
|
|||
if (Utils.isMobile())
|
||||
ap.hideSidePanel();
|
||||
}
|
||||
|
||||
|
||||
public void hideMessageMenu() {
|
||||
messageActionIcon.setVisible(false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue