Add post editing capability (#2828)
* Add post editing capability * Don't try to reprocess already uploaded attachments. Fixes editing posts with existing media * Don't mark post edits as modified until editing occurs * Disable UI for things that can't be edited when editing a post * Finally convert SFragment to kotlin * Use api endpoint for fetching status source for editing * Apply review feedback
This commit is contained in:
parent
51d02388b9
commit
a6b6a40ba6
20 changed files with 676 additions and 527 deletions
|
|
@ -168,12 +168,24 @@ class SendStatusService : Service(), Injectable {
|
|||
statusToSend.language,
|
||||
)
|
||||
|
||||
mastodonApi.createStatus(
|
||||
"Bearer " + account.accessToken,
|
||||
account.domain,
|
||||
statusToSend.idempotencyKey,
|
||||
newStatus
|
||||
).fold({ sentStatus ->
|
||||
val sendResult = if (statusToSend.statusId == null) {
|
||||
mastodonApi.createStatus(
|
||||
"Bearer " + account.accessToken,
|
||||
account.domain,
|
||||
statusToSend.idempotencyKey,
|
||||
newStatus
|
||||
)
|
||||
} else {
|
||||
mastodonApi.editStatus(
|
||||
statusToSend.statusId,
|
||||
"Bearer " + account.accessToken,
|
||||
account.domain,
|
||||
statusToSend.idempotencyKey,
|
||||
newStatus
|
||||
)
|
||||
}
|
||||
|
||||
sendResult.fold({ sentStatus ->
|
||||
statusesToSend.remove(statusId)
|
||||
// If the status was loaded from a draft, delete the draft and associated media files.
|
||||
if (statusToSend.draftId != 0) {
|
||||
|
|
@ -278,6 +290,7 @@ class SendStatusService : Service(), Injectable {
|
|||
failedToSend = true,
|
||||
scheduledAt = status.scheduledAt,
|
||||
language = status.language,
|
||||
statusId = status.statusId,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -387,4 +400,5 @@ data class StatusToSend(
|
|||
var retries: Int,
|
||||
val mediaProcessed: MutableList<Boolean>,
|
||||
val language: String?,
|
||||
val statusId: String?,
|
||||
) : Parcelable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue