about summary refs log tree commit diff
path: root/app/serializers/activitypub/note_serializer.rb
AgeCommit message (Collapse)Author
2023-04-09Fix most rubocop issues (#2165)Claire
* Run rubocop --autocorrect on app/, config/ and lib/, also manually fix some remaining style issues * Run rubocop --autocorrect-all on db/ * Run rubocop --autocorrect-all on `spec/` and fix remaining issues
2022-03-26Merge branch 'main' into glitch-soc/merge-upstreamClaire
Conflicts: - `app/lib/formatter.rb`: Upstream completely refactored the formatting code and removed that file, while glitch-soc had code for Markdown and HTML toots. Took upstream code, glitch-soc changes will be re-implemented on top of the refactored classes in a later commit. - `app/models/status.rb`: Upstream refactored status edit handling and moved code to `app/models/concerns/status_snapshot_concern.rb`. Applied glitch-soc's changes to that file. - `app/serializers/activitypub/note_serializer.rb`: Not really a conflict, just a line added too close to one modified by glitch-soc. Applied upstream changes while keeping the glitch-soc-modified one. - `app/services/update_status_service.rb`: Not really a conflict, upstream modified a line adjacent to one added by glitch-soc. Applied upstream changes while keeping the glitch-soc line. - `app/views/statuses/_simple_status.html.haml`: Upstream refactored formatting, glitch-soc changed the markup slightly. Applied upstream changes. - `spec/lib/formatter_spec.rb`: Upstream completely refactored the formatting code and removed that file, while glitch-soc had code for Markdown and HTML toots. Took upstream code, glitch-soc changes will be re-implemented on top of the refactored classes in a later commit.
2022-03-26Refactor formatter (#17828)Eugen Rochko
* Refactor formatter * Move custom emoji pre-rendering logic to view helpers * Move more methods out of Formatter * Fix code style issues * Remove Formatter * Add inline poll options to RSS feeds * Remove unused helper method * Fix code style issues * Various fixes and improvements * Fix test
2022-03-10Merge branch 'main' into glitch-soc/merge-upstreamClaire
Conflicts: - `app/models/status.rb`: Upstream updated media and edit-related code textually close to glitch-soc additions (local-only and content-type). Ported upstream changes. - `app/models/status_edit.rb`: Upstream changes textually close to glitch-soc additions (content-type). Ported upstream changes. - `app/serializers/activitypub/note_serializer.rb`: Upstream changed how media attachments are handled. Not really a conflict, but textually close to glitch-soc additions (directMessage attribute). Ported upstream changes. - `app/services/remove_status_service.rb`: Upstream changed how media attachments are handled. Not really a conflict, but textually close to glitch-soc additions (DM timeline). Ported upstream changes. - `app/services/update_status_service.rb`: Upstream fixed an issue with language selection. Not really a conflict, but textually close to glitch-soc additions (content-type). Ported upstream changes. - `db/schema.rb`: Upstream added columns to the `status_edits` table, the conflict is because of an additional column (`content-type`) in glitch-soc. Ported upstream changes. - `package.json`: Upstream dependency (express) textually adjacent to a glitch-soc-specific one (favico.js) got updated. Updated it as well.
2022-03-09Change how changes to media attachments are stored for edits (#17696)Eugen Rochko
* Change how changes to media attachments are stored for edits Fix not being able to re-order media attachments * Fix not broadcasting updates when polls/media is changed through ActivityPub * Various fixes and improvements * Update app/models/report.rb Co-authored-by: Claire <claire.github-309c@sitedethib.com> * Add tracking of media attachment description changes * Change poll in status edit to have a structure closer to the real one Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2022-01-19Merge branch 'main' into glitch-soc/merge-upstreamClaire
Conflicts: - `app/lib/activitypub/activity/create.rb`: Upstream refactored how `Create` activities are handled and how values are extracted from `Create`d objects. This conflicted with how glitch-soc supported the `directMessage` flag to explicitly distinguish between limited and direct messages. Ported glitch-soc's changes to latest upstream changes. - `app/services/fan_out_on_write_service.rb`: Upstream largely refactored that file and changed some of the logic. This conflicted with glitch-soc's handling of the direct timeline and the options to allow replies and boosts in public feeds. Ported those glitch-soc changes on top of latest upstream changes. - `app/services/process_mentions_service.rb`: Upstream refactored to move mention-related ActivityPub deliveries to `ActivityPub::DeliveryWorker`, while glitch-soc contained an extra check to not send local-only toots to remote mentioned users. Took upstream's version, as the check is not needed anymore, since it is performed at the `ActivityPub::DeliveryWorker` call site already. - `app/workers/feed_insert_worker.rb`: Upstream added support for `update` toot events, while glitch-soc had support for an extra timeline support, `direct`. Ported upstream changes and extended them to the `direct` timeline. Additional changes: - `app/lib/activitypub/parser/status_parser.rb`: Added code to handle the `directMessage` flag and take it into account to compute visibility. - `app/lib/feed_manager.rb`: Extended upstream's support of `update` toot events to glitch-soc's `direct` timeline.
2022-01-19Add support for editing for published statuses (#16697)Eugen Rochko
* Add support for editing for published statuses * Fix references to stripped-out code * Various fixes and improvements * Further fixes and improvements * Fix updates being potentially sent to unauthorized recipients * Various fixes and improvements * Fix wrong words in test * Fix notifying accounts that were tagged but were not in the audience * Fix mistake
2021-05-17Merge branch 'main' into glitch-soc/merge-upstreamClaire
Conflicts: - `README.md`: our READMEs are entirely different and upstream's has been updated. Kept our README.
2021-05-16Add width and height to attachments in ActivityPub (#16245)dogelover911
Co-authored-by: dogelover911 <dogelover911@localhost>
2020-11-13Fix media not being marked sensitive when outgoing CW is setThibaut Girka
Fixes #1461 Fixes a regression from a recent merge
2020-11-07Merge branch 'master' into glitch-soc/merge-upstreamThibaut Girka
2020-11-04Add account sensitized (#14361)Takeshi Umeda
* Add account sensitized * Fix i18n normalize * Fix description and spec * Fix spec * Fix wording
2020-08-04Add support for direct message assertionsFire Demon
2020-06-30Merge branch 'master' into glitch-soc/merge-upstreamThibaut Girka
Conflicts: - `.env.production.sample`: Upstream deleted it, I decided to keep it. - `package.json`: Upstream updated a dependency textually too close to wavesurfer.js which has been deleted from upstream but is kept in glitch-soc for now.
2020-06-29Add customizable thumbnails for audio and video attachments (#14145)Eugen Rochko
- Change audio files to not be stripped of metadata - Automatically extract cover art from audio if it exists - Add `thumbnail` parameter to `POST /api/v1/media`, `POST /api/v2/media` and `PUT /api/v1/media/:id` - Add `icon` to represent it in attachments in ActivityPub - Fix `preview_url` containing URL of missing missing image when there is no thumbnail instead of null - Fix duration of audio not being displayed on public pages until the file is loaded
2020-05-30Fix backup archive including outgoing-only content warningsThibaut Girka
2020-05-30Add support for setting Content Warning for CW-less outgoing tootsThibaut Girka
2019-09-30Merge branch 'master' into glitch-soc/merge-upstreamThibaut Girka
Conflicts: - Gemfile - Gemfile.lock - app/controllers/about_controller.rb - app/controllers/auth/sessions_controller.rb
2019-09-29Add voters count support (#11917)ThibG
* Add voters count to polls * Add ActivityPub serialization and parsing of voters count * Add support for voters count in WebUI * Move incrementation of voters count out of redis lock * Reword “voters” to “people”
2019-09-05Merge branch 'master' into glitch-soc/merge-upstreamThibaut Girka
2019-09-03Fix ActivityPub context not being dynamically computed (#11746)ThibG
* Fix contexts not being dynamically included Fixes #11649 * Refactor Note context in serializer * Refactor Actor serializer
2019-08-19Merge branch 'master' into glitch-soc/merge-upstreamThibaut Girka
Conflicts: - app/controllers/home_controller.rb - app/controllers/shares_controller.rb - app/javascript/packs/public.js - app/models/status.rb - app/serializers/initial_state_serializer.rb - app/views/home/index.html.haml - app/views/layouts/public.html.haml - app/views/public_timelines/show.html.haml - app/views/shares/show.html.haml - app/views/tags/show.html.haml - config/initializers/content_security_policy.rb - config/locales/en.yml - config/webpack/shared.js - package.json
2019-08-16Fix multiple issues with replies collection for pages further than ↵ThibG
self-replies (#11582) * Fix the replies collection returning snowflakes ids rather than URIs Fixes #11568 * Fix min_id in replies queries once self-replies are exhausted * Fix `next` attribute of replies collection being nil when there are no self-replies * Rename other_accounts param to only_other_accounts
2019-07-28Revert "Remove conversation URI (#11423)" (#11424)Eugen Rochko
This reverts commit 75f7f9930eb2a6f5c4041ec44fe0aa795c9ec449.
2019-07-28Remove conversation URI (#11423)Eugen Rochko
It is not part of ActivityPub and will free up a lot of space
2019-07-10Fix activity being rendered within activity due to caching (#11271)Eugen Rochko
Fix #11270
2019-07-08Refactor controllers for statuses, accounts, and more (#11249)Eugen Rochko
2019-07-05Allow serializing local-only toots in backup serviceThibaut Girka
Fixes #1153
2019-05-30Raise exception when attempting to serialize local-only statusesThibaut Girka
2019-04-27Add blurhash (#10630)Eugen Rochko
* Add blurhash * Use fallback color for spoiler when blurhash missing * Federate the blurhash and accept it as long as it's at most 5x5 * Display unknown media attachments as blurhash placeholders * Improve style of embed actions and spoiler button * Change blurhash resolution from 3x3 to 4x4 * Improve dependency definitions * Fix code style issues
2019-03-28Rename :poll to :preloadable_poll and :owned_poll to :poll on Status (#10401)Eugen Rochko
Also, fix some n+1 queries Resolve #10365
2019-03-27Remove unused ActivityPub `@context` values depending on response (#10378)Eugen Rochko
Fix #8078
2019-03-07Immediately display poll results to poll author (#10187)Eugen Rochko
* Immediately display poll results to poll author * Refactor Poll#loaded_options and add Poll#voted? to improve DRYness
2019-03-05Fix NoMethodError in ActivityPub::NoteSerializer (#10172)Eugen Rochko
2019-03-05Fix various issues in polls (#10165)Eugen Rochko
* Fix ActivityPub poll results being serialized even with hide_totals * Fix poll refresh button having a different font size * Display poll in OpenGraph description * Fix NoMethodError when serializing votes Regression from #10158 * Fix polls on public pages being broken for non-logged-in users * Do not show time remaining if poll has no expiration date
2019-03-03Add polls (#10111)Eugen Rochko
* Add polls Fix #1629 * Add tests * Fixes * Change API for creating polls * Use name instead of content for votes * Remove poll validation for remote polls * Add polls to public pages * When updating the poll, update options just in case they were changed * Fix public pages showing both poll and other media
2019-02-28Give the `replies` collection an identifier and enable pagination (#10128)ThibG
2019-02-28Improved remote thread fetching (#10106)ThibG
* Fetch up to 5 replies when discovering a new remote status This is used for resolving threads downwards. The originating server must add a “replies” attributes with such replies for it to be useful. * Add some tests for ActivityPub::FetchRepliesWorker * Add specs for ActivityPub::FetchRepliesService * Serialize up to 5 public self-replies for ActivityPub notes * Add specs for ActivityPub::NoteSerializer * Move exponential backoff logic to a worker concern * Fetch first page of paginated collections when fetching thread replies * Add specs for paginated collections in replies * Move Note replies serialization to a first CollectionPage The collection isn't actually paginable yet as it has no id nor a `next` field. This may come in another PR. * Use pluck(:uri) instead of map(&:uri) to improve performances * Fix fetching replies when they are in a CollectionPage
2018-10-17Improve support for aspects/circles (#8950)Eugen Rochko
* Add silent column to mentions * Save silent mentions in ActivityPub Create handler and optimize it Move networking calls out of the database transaction * Add "limited" visibility level masked as "private" in the API Unlike DMs, limited statuses are pushed into home feeds. The access control rules between direct and limited statuses is almost the same, except for counter and conversation logic * Ensure silent column is non-null, add spec * Ensure filters don't check silent mentions for blocks/mutes As those are "this person is also allowed to see" rather than "this person is involved", therefore does not warrant filtering * Clean up code * Use Status#active_mentions to limit returned mentions * Fix code style issues * Use Status#active_mentions in Notification And remove stream_entry eager-loading from Notification
2018-06-18Always send content for backwards-compatibility (#7844)Eugen Rochko
2018-06-18Serialize language into ActivityPub JSON (#7840)Eugen Rochko
* Serialize language into ActivityPub JSON * Only use contentMap if language is present
2018-03-22Do not re-query mentions from serializers (#6858)Eugen Rochko
Fix performance regression from #6836
2018-03-19Serialize mentions in the order they are added (#6836)ThibG
Up until now, the order seemed to be in the *opposite* order, which caused the WebUI to populate mentions in reversed order when replying to toots local to one's instance.
2018-03-04Fix missing focalPoint in ActivityPub JSON (#6609)Eugen Rochko
2017-10-07Encode custom emojis as resolveable objects in ActivityPub (#5243)Eugen Rochko
* Encode custom emojis as resolveable objects in ActivityPub * Improve code style
2017-09-28Add ability to specify alternative text for media attachments (#5123)Eugen Rochko
* Fix #117 - Add ability to specify alternative text for media attachments - POST /api/v1/media accepts `description` straight away - PUT /api/v1/media/:id to update `description` (only for unattached ones) - Serialized as `name` of Document object in ActivityPub - Uploads form adjusted for better performance and description input * Add tests * Change undo button blend mode to difference
2017-09-19Introduce OStatus::TagManager (#5008)Akihiko Odaki
2017-09-19Custom emoji (#4988)Eugen Rochko
* Custom emoji - In OStatus: `<link rel="emoji" name="coolcat" href="http://..." />` - In ActivityPub: `{ type: "Emoji", name: ":coolcat:", href: "http://..." }` - In REST API: Status object includes `emojis` array (`shortcode`, `url`) - Domain blocks with reject media stop emojis - Emoji file up to 50KB - Web UI handles custom emojis - Static pages render custom emojis as `<img />` tags Side effects: - Undo #4500 optimization, as I needed to modify it to restore shortcode handling in emojify() - Formatter#plaintext should now make sure stripped out line-breaks and paragraphs are replaced with newlines * Fix emoji at the start not being converted
2017-09-16Fix AP serialization error when thread is missing (#4970)unarist
`Status#reply?` may returns true even if the thread is missing. e.g. the replied status was deleted or couldn't be fetched. Then it raises NoMethodError on various AP json serialization. This issue won't happen on Atom serialization because it checks thread existence using `StreamEntry#threaded?` instead.
2017-09-12Fix nil error for old toots that don't have a conversation (#4900)Eugen Rochko