mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Refactor Author.Status into dedicated AuthorInfo class and add alias
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.bramble.identity
|
||||
|
||||
import org.briarproject.bramble.api.identity.Author
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo
|
||||
import org.briarproject.briar.headless.json.JsonDict
|
||||
|
||||
fun Author.output() = JsonDict(
|
||||
@@ -10,4 +11,4 @@ fun Author.output() = JsonDict(
|
||||
"publicKey" to publicKey
|
||||
)
|
||||
|
||||
fun Author.Status.output() = name.toLowerCase()
|
||||
fun AuthorInfo.Status.output() = name.toLowerCase()
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.briarproject.briar.headless.json.JsonDict
|
||||
internal fun BlogPostHeader.output(text: String) = JsonDict(
|
||||
"text" to text,
|
||||
"author" to author.output(),
|
||||
"authorStatus" to authorStatus.output(),
|
||||
"authorStatus" to authorInfo.status.output(),
|
||||
"type" to type.output(),
|
||||
"id" to id.bytes,
|
||||
"parentId" to parentId?.bytes,
|
||||
|
||||
@@ -6,7 +6,8 @@ import io.mockk.Runs
|
||||
import io.mockk.every
|
||||
import io.mockk.just
|
||||
import io.mockk.mockk
|
||||
import org.briarproject.bramble.api.identity.Author.Status.OURSELVES
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo
|
||||
import org.briarproject.bramble.api.identity.AuthorInfo.Status.OURSELVES
|
||||
import org.briarproject.bramble.api.sync.MessageId
|
||||
import org.briarproject.bramble.identity.output
|
||||
import org.briarproject.bramble.util.StringUtils.getRandomString
|
||||
@@ -30,8 +31,16 @@ internal class BlogControllerTest : ControllerTest() {
|
||||
private val rssFeed = false
|
||||
private val read = true
|
||||
private val header = BlogPostHeader(
|
||||
POST, group.id, message.id, parentId, message.timestamp, timestamp, author, OURSELVES,
|
||||
rssFeed, read
|
||||
POST,
|
||||
group.id,
|
||||
message.id,
|
||||
parentId,
|
||||
message.timestamp,
|
||||
timestamp,
|
||||
author,
|
||||
AuthorInfo(OURSELVES),
|
||||
rssFeed,
|
||||
read
|
||||
)
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user