about summary refs log tree commit diff
path: root/app/services
AgeCommit message (Collapse)Author
2017-05-12Add conversation model, <ostatus:conversation /> (#3016)Eugen Rochko
* Add <ostatus:conversation /> tag to Atom input/output Only uses ref attribute (not href) because href would be the alternate link that's always included also. Creates new conversation for every non-reply status. Carries over conversation for every reply. Keeps remote URIs verbatim, generates local URIs on the fly like the rest of them. * Fix conversation migration * More spec coverage for status before_create * Prevent n+1 query when generating Atom with the new conversations * Improve code style * Remove redundant local variable
2017-05-12Fix not rejecting remote URIs when parsing out local IDs (#3012)Eugen Rochko
2017-05-11Fix #1426 - Trim long usernames in public follower/following lists (#2993)Eugen Rochko
Fix #2221 - Catch OpenSSL exceptions when loading remote avatars/headers/attachments Don't strip "rel" attribute from <a> tags when sanitizing (microformats)
2017-05-11Fix regressions from #2683 (#2970)Eugen Rochko
* Fix regressions from #2683 Properly format spoiler text HTML, while keeping old logic for blankness intact Process hashtags and mentions in spoiler text Format spoiler text for Atom Change "show more" toggle into a button instead of anchor Fix style regression on dropdowns for detailed statuses * Fix lint issue * Convert spoiler text to plaintext in desktop notifications
2017-05-10Fix #2955 - Send HEAD request ahead of GET when fetching URL previews (#2972)Eugen Rochko
2017-05-10Add `account_id DESC` to optimize PrecomputeFeedService (#2967)alpaca-tc
2017-05-10Handle hashtags in spoiler_texts (partial fix for #699) (#2683)R Tucker
* services: scan spoiler_text for hashtags (#699) * views: link hashtags from spoiler_texts This covers linking hashtags from within the spoiler text on the server-generated pages. * services: fix string concat going into hashtag RE Cleaner Ruby syntax, may handle immutable strings better
2017-05-10Add spec for Pubsubhubbub::DistributionWorker. PuSH-deliver public items (#2954)Eugen Rochko
to all subscribers. IDN-normalize callback URLs for subscriptions on insert.
2017-05-09Specs for pubsub subscribe service (#2951)Matt Jankowski
* Add spec for pubsubhubbub/subscribe * Refactor pubsubhubbub/subscribe service
2017-05-09Spec and refactor for pubsubhubbub/unsubscribe service (#2946)Matt Jankowski
* Add coverage for pubsub unsubscribe service * Refactor pubsub unsubscribe service
2017-05-09Services specs for subscribe and unsubscribe (#2928)Matt Jankowski
* Add specs for unsubscribe service * Fix non existent methods in unsubscribe service * Clean up status handling in subscribe service
2017-05-07Unblock domain service specs/refactor (#2867)Matt Jankowski
* Add spec for unblock domain service * Refactor UnblockDomainService
2017-05-06Hotfix convert string from symbol (#2856)alpaca-tc
* Convert key to string from symbol * Prefer :public_send instead of
2017-05-06Refactor domain_blocks_controller (#2843)alpaca-tc
* Set domain_block by before_action * Cast value with ActiveRecord::Type * Batch update
2017-05-06Optimize MuteService and AfterBlockService (#2836)alpaca-tc
2017-05-06Handling failed http response (#2823)alpaca-tc
2017-05-05Move account header and avatar methods to a concern (#2825)Matt Jankowski
2017-05-05Add specs (and refactor) of FetchRemoteResourceService and SearchService (#2812)Matt Jankowski
* Coverage for fetch remote resource service * Refactor fetch remote resource service * Coverage for search service * Refactor search service
2017-05-05More robust PuSH subscription refreshes (#2799)Eugen Rochko
* Fix #2473 - Use sidekiq scheduler to refresh PuSH subscriptions instead of cron Fix an issue where / in domain would raise exception in TagManager#normalize_domain PuSH subscriptions refresh done in a round-robin way to avoid hammering a single server's hub in sequence. Correct handling of failures/retries through Sidekiq (see also #2613). Optimize Account#with_followers scope. Also, since subscriptions are now delegated to Sidekiq jobs, an uncaught exception will not stop the entire refreshing operation halfway through Fix #2702 - Correct user agent header on outgoing http requests * Add test for SubscribeService * Extract #expiring_accounts into method * Make mastodon:push:refresh no-op * Queues are now defined in sidekiq.yml * Queues are now in sidekiq.yml
2017-05-04Delete records in smaller transaction (#2802)alpaca-tc
2017-05-04Decode IDNA in PreviewCard (#2781)Yamagishi Kazutoshi
2017-05-04Likely fix #2458, fix #2031 - handle out-of-order deletes for statuses (#2734)Eugen Rochko
* Likely fix #2458, fix #2031 - handle out-of-order deletes for statuses If a delete arrives before the original status, cache that information for 6h, and if the original status arrives in that window, ignore it * Add test case
2017-05-03Fix #2706 - Always respond with 200 to PuSH payloads (#2733)Eugen Rochko
Fix #2196 - Respond with 201 when Salmon accepted, 400 when unverified Fix #2629 - Correctly handle confirm_domain? for local accounts Unify rules for extracting author acct from XML, prefer <email>, fall back to <name> + <uri> (see also #2017, #2172)
2017-04-30Downgrade rubocop 0.48.1 => 0.46.0 (#2628)yhirano
* downgrade rubocop 0.48.1 => 0.46.0 * exclude vendor/**/* from rubocop target files * add frozen_string_literal comment line * fix percent literal delimited by ( and ) * fix alignment * remove comment disabling unknown cop
2017-04-29Set unknown attachment type when adding domain blocks (#2605)Patrick Figel
Follow-up to #2599. When a domain block with `reject_media` is added or `rake mastodon:media:remove_remote` is invoked, mastodon deletes the locally cached attachments and avatars but does not reflect that change in the database, causing the `file` fields to still have values. This change persists the deletion in the database and sets the attachment type to unknown. This also introduces a one-off rake task that sets all attachments without a local file to the "unknown" type. The upgrade notes for the next release should contain a post-upgrade step with `rake mastodon:media:set_unknown`.
2017-04-27Improve shared status verification (#2525)Eugen Rochko
* Instead of parsing shared status contents verbatim, make roundtrip to purported original URL. Confirm that the "original" URL is from the same domain as the author it claims to be from. * Fix obvious typo, add comment * Use URI look-up first * Add test, update Goldfinger dependency to make less useless HTTP requests per Webfinger lookup
2017-04-27OEmbed support for PreviewCard (#2337)Eugen Rochko
* OEmbed support for PreviewCard * Improve ProviderDiscovery code failure treatment * Do not crawl links if there is a content warning, since those don't display a link card anyway * Reset db schema * Fresh migrate * Fix rubocop style issues Fix #1681 - return existing access token when applicable instead of creating new * Fix test * Extract http client to helper * Improve oembed controller
2017-04-26Domain block service cleanup (#2490)Matt Jankowski
* Add coverage for domain block service with silence * Get rid of warning about find_each and order * Move domain_block to attr_reader * Move optional clear_media into silence_accounts method * Use blocked_domain method to reduce passed vars * Extract blocked_domain_accounts method to find accounts on the domain * Extract media_from_blocked_domain method to find relevant attachments * Separate destruction of account images and account attachments
2017-04-26attach_media should be in transaction of creation status (#2426)Keiji, Yoshimi
2017-04-25Fix #2402 - Add Idempotency-Key header to PostStatusService that prevents ↵Eugen Rochko
(#2419) duplicates. Web UI regenerates UUID for that header every time the compose form is changed or successfully submitted Also, fix Farsi i18n overwriting the English one
2017-04-25Optimize account search (#2421)178inaba
2017-04-25Punycode URI normalization (#2370)Eugen
* Fix #2119 - Whenever about to send a HTTP request, normalize the URI * Add test for IDN request in FetchLinkCardService * Perform IDN normalization on domains before they are stored in the DB
2017-04-23Show multibyte URI preview card (#2363)Yamagishi Kazutoshi
2017-04-22Improve bio compatibility (#2278)Eugen
* Fix #1057 (close #1819) - Move HTML-formatted bio from <poco:note /> to <summary type="html" /> * Ensure <poco:note /> is plaintext for remote accounts, also, by stripping out HTML
2017-04-21Add Mastodon version to user agent (#2253)ik-fib
2017-04-19Fix possibility of unrightful webfinger redirect (#2147)Eugen
* Fix possibility of unrightful webfinger redirect * Add more tests for FollowRemoteAccountService
2017-04-18Language detection refactor (#2099)Matt Jankowski
* Extract detect_language to separate class * Use default locale, not just en * Add spec to confirm that whatlanguage cant identify empty string * Allow account locale to override default in language detector * PostStatusService supplies an account to detect language
2017-04-18Add "Mastodon" to user agent (#2073)ik-fib
Remove non-const version string Freeze option is unnecessary
2017-04-17Fix nil query_username (#2013)Tomohiro Suwa
2017-04-17reduce unneed query when post without attachements. (#1907)Keiji, Yoshimi
* reduce unneed query when post without attachements. This commit reduce following query: ``` MediaAttachment Load (0.9ms) SELECT "media_attachments".* FROM "media_attachments" WHERE "media_attachments"."status _id" IS NULL AND 1=0 ORDER BY id asc ``` * fixed for more simple changes.
2017-04-16Fix #1957 - WhatLanguage can return null. Fallback to 'en' (#1959)Eugen
2017-04-16Add language detection (#1772)Eugen
* Add language detection via WhatLanguage and (de)serialization of it through Atom * Fix default language in ProcessFeedService * Re-add newline before 'react-rails' Gem to fix groupings Fixes Code Climate issue
2017-04-16Check @recipient.user at the first (#1939)alpaca-tc
2017-04-16Fix #1813 - Alleviate extra requests when processing mentions (#1938)Eugen
The <link rel="mentioned" /> tag refers to accounts by href. So we were matching the DB by the url attribute, and falling back to HTTP look-up. However, GS and Mastodon use profile URLs as URIs, too, and the match for that was missing. This could potentially alleviate some extra network requests
2017-04-16Clean up check that account needs a webfinger update (#1932)Matt Jankowski
2017-04-16Fixed NoMethodError in UnfollowService (#1918)alpaca-tc
2017-04-16Make file attachment on MediaAttachment optional (#1865)Eugen
Create MediaAttachment but without actual file download when domain is blocked with reject_media set to true Clean up old media files when creating a new domain block with reject_media set to true Return remote_url in media attachments API if local file is not present Undo domain block action in admin UI Ability to enable reject_media from admin UI
2017-04-15ActiveRecord::Relation does not respond to `#id` (#1834)alpaca-tc
2017-04-15Account search service refactor (#1791)Matt Jankowski
* Begin coverage for account search service * Coverage for hashtag query * Coverage for calling local vs remote find based on domain presence * Spec to check that exact matches are not duped * Coverage of resolve option * Coverage for account being provided * Start to refactor account search service * Isolate query username and domain methods * Isolate exact_match method * Extract methods for local and remote results * Simplify local vs remote and account isoliation * Extract methods for local and remote results * Simplify de-dupe of exact match * Simplify logic to check for non exact remotes * Cache some methods * Remove nil from exact_match from results array * Return exact matches first * Use find_remote even with no domain Account.find_local is just an alias for Account.find_remote(user, nil) - so we can not bother with the conditional here, and call find_remote directly.
2017-04-15Refresh webfinger (#1323)ThibG
* Refresh local info for remote accounts when webfinger returns new values It only refreshes account info if one of the URLs or the public-key changes, in which cases it refreshes the full info, re-downloading the feeds from that user. Some special handling should probably be done when the public key changes, but I have been unable to find any use for it in Mastodon yet. * Re-fetch remote users we aren't subscribed to. This might induce performance issues, we might want to only do that for users we explicitly attempted to subscribe but failed to. * Refactor changes * Do not refresh existing remote account details more than once a day * Avoid re-fetching webfinger info in tests unless otherwise specified