-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Resolving user references during export to markdown (Confluence…
… Server only) Closes #51
- Loading branch information
Showing
13 changed files
with
198 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
confluence-client/src/main/kotlin/com/github/zeldigas/confclient/model/User.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.github.zeldigas.confclient.model | ||
|
||
data class User(val type: String?, val username: String?, val userKey: String?, val displayName: String?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...n/kotlin/com/github/zeldigas/text2confl/convert/markdown/export/ConfluenceUserResolver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.github.zeldigas.text2confl.convert.markdown.export | ||
|
||
interface ConfluenceUserResolver { | ||
|
||
companion object { | ||
val NOP = object : ConfluenceUserResolver { | ||
override fun resolve(userKey: String): String? = null | ||
} | ||
} | ||
|
||
fun resolve(userKey: String): String? | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<p>Known user: | ||
<ac:link> | ||
<ri:user ri:userkey="known"/> | ||
</ac:link> | ||
</p> | ||
<p>Known user as email: | ||
<ac:link> | ||
<ri:user ri:userkey="known_email"/> | ||
</ac:link> | ||
</p> | ||
<p>Unknown user: | ||
<ac:link> | ||
<ri:user ri:userkey="unknown"/> | ||
</ac:link> | ||
</p> | ||
<p>Ignored user: | ||
<ac:link> | ||
<ri:user ri:account-id="some-id"/> | ||
</ac:link> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Known user: @user | ||
|
||
Known user as email: @"user@example.org" | ||
|
||
Unknown user: | ||
|
||
Ignored user: |
20 changes: 20 additions & 0 deletions
20
.../src/main/kotlin/com/github/zeldigas/text2confl/core/export/ConfluenceUserResolverImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.github.zeldigas.text2confl.core.export | ||
|
||
import com.github.zeldigas.confclient.ConfluenceClient | ||
import com.github.zeldigas.text2confl.convert.markdown.export.ConfluenceUserResolver | ||
import kotlinx.coroutines.runBlocking | ||
|
||
class ConfluenceUserResolverImpl(private val client: ConfluenceClient) : ConfluenceUserResolver { | ||
|
||
private val cache: MutableMap<String, String?> = mutableMapOf() | ||
|
||
override fun resolve(userKey: String): String? { | ||
return cache.computeIfAbsent(userKey) { key -> | ||
runBlocking { | ||
val user = client.getUserByKey(key) | ||
user.username | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters