Fix bug where available invitations were marked answered

Now an invitiation was answered when it is no longer available
parent 4b325f79
......@@ -15,9 +15,9 @@ public abstract class InvitationRequest<S extends Shareable> extends
public InvitationRequest(MessageId messageId, GroupId groupId, long time,
boolean local, boolean sent, boolean seen, boolean read,
SessionId sessionId, S object, @Nullable String message,
boolean answered, boolean canBeOpened) {
boolean available, boolean canBeOpened) {
super(messageId, groupId, time, local, sent, seen, read, sessionId,
object, message, answered);
object, message, !available);
this.canBeOpened = canBeOpened;
}
......
......@@ -104,6 +104,7 @@ public class GroupInvitationIntegrationTest
assertFalse(request.isLocal());
assertFalse(request.isRead());
assertFalse(request.canBeOpened());
assertFalse(request.wasAnswered());
}
@Test
......@@ -181,6 +182,7 @@ public class GroupInvitationIntegrationTest
} else {
GroupInvitationRequest request = (GroupInvitationRequest) m;
assertEquals(privateGroup0, request.getNameable());
assertTrue(request.wasAnswered());
assertTrue(request.canBeOpened());
}
}
......
......@@ -153,7 +153,7 @@ public class BlogSharingIntegrationTest
if (m instanceof BlogInvitationRequest) {
BlogInvitationRequest invitation = (BlogInvitationRequest) m;
assertEquals(blog2, invitation.getNameable());
assertFalse(invitation.wasAnswered());
assertTrue(invitation.wasAnswered());
assertEquals(blog2.getAuthor().getName(),
invitation.getName());
assertFalse(invitation.getNameable().isRssFeed());
......@@ -226,7 +226,7 @@ public class BlogSharingIntegrationTest
if (m instanceof BlogInvitationRequest) {
BlogInvitationRequest invitation = (BlogInvitationRequest) m;
assertEquals(rssBlog, invitation.getNameable());
assertFalse(invitation.wasAnswered());
assertTrue(invitation.wasAnswered());
assertEquals(rssBlog.getAuthor().getName(),
invitation.getName());
assertTrue(invitation.getNameable().isRssFeed());
......@@ -288,7 +288,7 @@ public class BlogSharingIntegrationTest
if (m instanceof BlogInvitationRequest) {
BlogInvitationRequest invitation = (BlogInvitationRequest) m;
assertEquals(blog2, invitation.getNameable());
assertFalse(invitation.wasAnswered());
assertTrue(invitation.wasAnswered());
assertEquals(blog2.getAuthor().getName(),
invitation.getName());
assertEquals(null, invitation.getMessage());
......
......@@ -135,7 +135,7 @@ public class ForumSharingIntegrationTest
for (PrivateMessageHeader m : list) {
if (m instanceof ForumInvitationRequest) {
ForumInvitationRequest invitation = (ForumInvitationRequest) m;
assertFalse(invitation.wasAnswered());
assertTrue(invitation.wasAnswered());
assertEquals(forum0.getName(), invitation.getName());
assertEquals(forum0, invitation.getNameable());
assertEquals("Hi!", invitation.getMessage());
......@@ -192,7 +192,7 @@ public class ForumSharingIntegrationTest
if (m instanceof ForumInvitationRequest) {
ForumInvitationRequest invitation = (ForumInvitationRequest) m;
assertEquals(forum0, invitation.getNameable());
assertFalse(invitation.wasAnswered());
assertTrue(invitation.wasAnswered());
assertEquals(forum0.getName(), invitation.getName());
assertEquals(null, invitation.getMessage());
assertFalse(invitation.canBeOpened());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment