mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Remove local author from contacts.
This commit is contained in:
@@ -11,6 +11,7 @@ import org.briarproject.bramble.api.db.DatabaseExecutor
|
||||
import org.briarproject.bramble.api.db.NoSuchContactException
|
||||
import org.briarproject.bramble.api.event.Event
|
||||
import org.briarproject.bramble.api.event.EventListener
|
||||
import org.briarproject.bramble.api.identity.IdentityManager
|
||||
import org.briarproject.bramble.api.system.Clock
|
||||
import org.briarproject.bramble.util.StringUtils.utf8IsTooLong
|
||||
import org.briarproject.briar.api.blog.BlogInvitationRequest
|
||||
@@ -46,6 +47,7 @@ internal class MessagingControllerImpl
|
||||
@Inject
|
||||
constructor(
|
||||
private val messagingManager: MessagingManager,
|
||||
private val identityManager: IdentityManager,
|
||||
private val conversationManager: ConversationManager,
|
||||
private val privateMessageFactory: PrivateMessageFactory,
|
||||
private val contactManager: ContactManager,
|
||||
@@ -71,7 +73,7 @@ constructor(
|
||||
if (utf8IsTooLong(message, MAX_PRIVATE_MESSAGE_TEXT_LENGTH))
|
||||
throw BadRequestResponse("Message text is too long")
|
||||
|
||||
val group = messagingManager.getContactGroup(contact)
|
||||
val group = messagingManager.getContactGroup(contact, identityManager.localAuthor.id)
|
||||
val now = clock.currentTimeMillis()
|
||||
val m = privateMessageFactory.createPrivateMessage(group.id, now, message, emptyList())
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class ControllerTest {
|
||||
protected val group: Group = getGroup(getClientId(), 0)
|
||||
protected val author: Author = getAuthor()
|
||||
protected val localAuthor: LocalAuthor = getLocalAuthor()
|
||||
protected val contact: Contact = getContact(author, localAuthor.id, true)
|
||||
protected val contact: Contact = getContact(author, true)
|
||||
protected val message: Message = getMessage(group.id)
|
||||
protected val text: String = getRandomString(5)
|
||||
protected val timestamp = 42L
|
||||
|
||||
@@ -40,6 +40,7 @@ internal class MessagingControllerImplTest : ControllerTest() {
|
||||
|
||||
private val controller = MessagingControllerImpl(
|
||||
messagingManager,
|
||||
identityManager,
|
||||
conversationManager,
|
||||
privateMessageFactory,
|
||||
contactManager,
|
||||
@@ -114,7 +115,8 @@ internal class MessagingControllerImplTest : ControllerTest() {
|
||||
|
||||
expectGetContact()
|
||||
every { ctx.body() } returns """{"text": "$text"}"""
|
||||
every { messagingManager.getContactGroup(contact) } returns group
|
||||
every { identityManager.localAuthor } returns localAuthor
|
||||
every { messagingManager.getContactGroup(contact, localAuthor.id) } returns group
|
||||
every { clock.currentTimeMillis() } returns timestamp
|
||||
every {
|
||||
privateMessageFactory.createPrivateMessage(
|
||||
|
||||
Reference in New Issue
Block a user