Skip to content

Commit 0935a05

Browse files
committed
Make sure Mastodon posts are unlisted
1 parent 93d565a commit 0935a05

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Sources/App/Core/Mastodon.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ enum Mastodon {
3131
components.scheme = "https"
3232
components.host = apiHost
3333
components.path = apiPath
34-
components.queryItems = [URLQueryItem(name: "status", value: message)]
34+
components.queryItems = [
35+
URLQueryItem(name: "status", value: message),
36+
URLQueryItem(name: "visibility", value: "unlisted")
37+
]
3538
guard let url = components.string else {
3639
throw Social.Error.invalidURL
3740
}

Tests/AppTests/MastodonTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ import XCTVapor
2121

2222
final class MastodonTests: AppTestCase {
2323

24+
func test_apiURL() throws {
25+
let url = try Mastodon.apiURL(with: "message")
26+
XCTAssert(url.contains("visibility=unlisted"), "was: \(url)")
27+
}
28+
2429
func test_endToEnd() async throws {
2530
let message = QueueIsolated<String?>(nil)
2631
try await withDependencies {

0 commit comments

Comments
 (0)