gotosocial/internal/db
ewwwin 424f62dd70
[bugfix] Store and expose status content type (#3870)
* Add ContentType to internal models

* Add ContentType to API models StatusSource and StatusEdit

* Add helpers to convert between API/internal StatusContentType

* Write status content type on create/edit

* Add migration

* Update API docs

go run github.com/go-swagger/go-swagger/cmd/swagger generate spec --scan-models --exclude-deps --output docs/api/swagger.yaml

* ensure ContentType is updated anywhere Text is

* Update docs, take care of TODOs

* Set ContentType in more places where Text is set

* We don't actually use ContentType on the API status model

* Update StatusSource test

* Remove unused helper function I copied

* Revert change to StatusContentType swagger annotation

I'm going to include this in a follow-on PR instead.

* Add test for updating content type in edits

* Return a value from processContentType instead of modifying the existing status

Fixes an issue that was caught by the test I just added - the recorded edit would be marked with the *new* content type instead of the old one, which is obviously bad

* Add test for handling of statuses with no stored content type

* repurpose an existing test status instead of adding a new one to avoid breaking other tests

* Add test to ensure newly created statuses always have content type saved

* Do include content type on status API model actually

This is mostly important when deleting and redrafting.

The comment on `apimodel.Status.Text` implies that it's not sent except in response to status deletion, but actually this doesn't seem to be the case; it also appears to be present in responses to creations and normal fetches and stuff. So I'm treating `ContentType` the same here.

* Update new tests to check content type on API statuses

* Check content type of API statuses in all tests where text is checked

* update other api tests with status content type field

* Add test ensuring text and content type are returned when deleting a status

* Convert processContentType to free function and remove unused parameter

* check for the correct value in the deletion test

* Be explicit about this test status having an empty content type

* Use omitempty consistently on API models

* clean up the final diff a bit

* one more swagger regen for the road

* Handle nil statuses in processContentType

* Don't pass processContentType the entire edit form, it doesn't need it

* Move processContentType to common.go and use for creation as well

* Remove unused parameters to ContentTypeToAPIContentType
2025-03-06 16:31:52 +00:00
..
bundb [bugfix] Store and expose status content type (#3870) 2025-03-06 16:31:52 +00:00
postgres [experiment] add alternative wasm sqlite3 implementation available via build-tag (#2863) 2024-05-27 17:46:15 +02:00
sqlite updates exported interface types to match ncruces/go-sqlite3/driver methods (#3440) 2024-10-14 20:28:59 +00:00
test [chore] replace statuses.updated_at column with statuses.edited_at (#3636) 2025-01-08 11:29:23 +01:00
account.go [performance] cache more database calls, reduce required database calls overall (#3290) 2024-09-16 16:46:09 +00:00
admin.go [feature] New user sign-up via web page (#2796) 2024-04-11 11:45:53 +02:00
advancedmigration.go [feature] Conversations API (#3013) 2024-07-23 20:44:31 +01:00
application.go [feature] Add token review / delete to backend + settings panel (#3845) 2025-03-04 10:01:25 +00:00
basic.go [feature] Add healthcheck endpoints /livez and /readyz (#2783) 2024-03-25 17:05:14 +00:00
conversation.go [feature] Conversations API (#3013) 2024-07-23 20:44:31 +01:00
db.go [feature] Push notifications (#3587) 2025-01-23 16:47:30 -08:00
domain.go [feature] Create/update/remove domain permission subscriptions (#3623) 2025-01-05 13:20:33 +01:00
emoji.go [bugfix] fix possible infinite loops in media / emoji cleanup (#2590) 2024-01-31 13:31:53 +00:00
error.go [experiment] add alternative wasm sqlite3 implementation available via build-tag (#2863) 2024-05-27 17:46:15 +02:00
filter.go [feature] Implement Filter API v2 (#2936) 2024-05-31 12:55:56 +02:00
headerfilter.go [feature] request blocking by http headers (#2409) 2023-12-18 14:18:25 +00:00
instance.go [feature] New user sign-up via web page (#2796) 2024-04-11 11:45:53 +02:00
interaction.go [feature] Interaction requests client api + settings panel (#3215) 2024-08-24 11:49:37 +02:00
list.go [performance] cache more database calls, reduce required database calls overall (#3290) 2024-09-16 16:46:09 +00:00
marker.go [feature] Implement markers API (#1989) 2023-07-29 12:49:14 +02:00
media.go [bugfix] fix possible infinite loops in media / emoji cleanup (#2590) 2024-01-31 13:31:53 +00:00
mention.go [feature] add support for polls + receiving federated status edits (#2330) 2023-11-08 14:32:17 +00:00
move.go [feature] Process outgoing Move from clientAPI (#2750) 2024-03-13 13:53:29 +01:00
notification.go [bugfix] notification types missing from link header (#3571) 2024-11-25 15:33:21 +00:00
params.go [chore] Improve copyright header handling (#1608) 2023-03-12 16:00:57 +01:00
poll.go [bugfix] update fedi api to support multiple separate votes in same multiple choice poll (#3809) 2025-02-20 11:13:07 +01:00
relationship.go [performance] cache more database calls, reduce required database calls overall (#3290) 2024-09-16 16:46:09 +00:00
report.go [performance] cache more database calls, reduce required database calls overall (#3290) 2024-09-16 16:46:09 +00:00
rule.go [feature] Instance rules (#2125) 2023-08-19 14:33:15 +02:00
search.go [feature] Add from: search operator and account_id query param (#2943) 2024-05-31 12:57:42 +02:00
session.go [performance] retry db queries on busy errors (#2025) 2023-07-25 10:34:05 +02:00
sinbinstatus.go [feature] Process Reject of interaction via fedi API, put rejected statuses in the "sin bin" 😈 (#3271) 2024-09-10 12:34:49 +00:00
status.go [feature] add support for clients editing statuses and fetching status revision history (#3628) 2024-12-23 17:54:44 +00:00
statusbookmark.go [feature] do not uncache status / emoji media if attached status is bookmarked (#2956) 2024-06-06 11:44:43 +01:00
statusedit.go [feature] add support for receiving federated status edits (#3597) 2024-12-05 13:35:07 +00:00
statusfave.go [chore] Add interaction policy gtsmodels (#3075) 2024-07-11 15:44:29 +01:00
tag.go [feature] Implement following hashtags (#3141) 2024-07-29 19:26:31 +01:00
thread.go [feature] Status thread mute/unmute functionality (#2278) 2023-10-25 15:04:53 +01:00
timeline.go [feature] Hashtag federation (in/out), hashtag client API endpoints (#2032) 2023-07-31 15:47:35 +02:00
tombstone.go [performance] retry db queries on busy errors (#2025) 2023-07-25 10:34:05 +02:00
user.go [feature] Admin accounts endpoints; approve/reject sign-ups (#2826) 2024-04-13 13:25:10 +02:00
util.go [experiment] add alternative wasm sqlite3 implementation available via build-tag (#2863) 2024-05-27 17:46:15 +02:00
webpush.go [feature] Push notifications (#3587) 2025-01-23 16:47:30 -08:00
workertask.go [feature] persist worker queues to db (#3042) 2024-07-30 13:58:31 +02:00