about summary refs log tree commit diff
path: root/app/services
AgeCommit message (Collapse)Author
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
2017-04-15Allow running mastodon on a different domain as the one used for identifying ↵ThibG
users (#1267) * Allow running mastodon on a different domain as the one used for identifying users * Alter documentation of WEB_DOMAIN to make clear it shouldn't be used unless the admin knows what they are doing * Compare to web_domain instead of local_domain when dealing with feeds/API * Correctly identify mentions to local accounts Mentions URLs point to the person's web profile, i.e., the user page served on WEB_DOMAIN.
2017-04-12Silence more scope order warnings (#1604)Matt Jankowski
2017-04-11Remove unused AtomBuilderHelper (#1364)Matt Jankowski
This was used in the views/atom/user_stream.xml.ruby file, which no longer is used.
2017-04-09Get handle from atom feed's author/email field instead of guessing from URL ↵ThibG
(#1344) The goal of this change is to enhance Mastodon's handling of remote domains for which the APIs reside on a different host (see issue #1032). Indeed, when a remote user unknown to Mastodon is mentionned, only its profile URL (e.g. https://social.example.org/users/User) is known, and Mastodon has to build a @username@domain handle for it. To do so, Mastodon fetches the user's atom feed (e.g., https://social.example.org/users/User.atom) and uses its content to get the username part of the handle, and the URL's host part to build the domain (e.g., @User@social.example.org). This handle is then used for a Webfinger request. In the case where example.org serves the Webfinger info for @User@example.org and all feeds and APIs are hosted at social.example.org, Mastodon will still build @User@social.example.org and fail at resolving the account's details through Webfinger. This patch changes this behaviour by using the author's email address from the atom feed to build the handle. In Mastodon-generated atom feeds, the email address is always the handle it expects for federation.
2017-04-08Fix #1141, fix #1126 - Avatar/profile info fetching (#1215)Eugen
* Fix #1141, fix #1126 - Work through UpdateRemoteProfileService for both <feed> and <entry> top-level tags * Improve code quality, remove line unrelated to fix
2017-04-08Merge pull request #1218 from R0ckweb/patch-2Eugen
Fix #1141 on remote follow
2017-04-08#1141 on remote followYann GUERN
The async action is send before persist, account.id not yet generated Pull queue receive 'nil' so no profile update.
2017-04-08Fix #801 - Respect webfinger's canonical response of username/domainEugen Rochko
2017-04-07Use I18n for media attachment validation errorsChad Pytel
These are currently user facing errors, but are not localized. This adds the ability for these messages to be localized.
2017-04-07Rewrite Atom generation from stream entries to use Ox instead of Nokogiri ↵Eugen
(#1124) * Rewrite Atom generation from stream entries to use Ox instead of Nokogiri::Builder StreamEntry is now limited to only statuses, which allows some optimization. Removed extra queries on AccountsController#show. AtomSerializer instead of AtomBuilderHelper used in AccountsController#show, StreamEntriesController#show, StreamEntryRenderer and PubSubHubbub::DistributionWorker PubSubHubbub::DistributionWorker moves n+1 DomainBlock query to PubSubHubbub::DeliveryWorker instead. All Salmon slaps that aren't based on StreamEntry still use AtomBuilderHelper and Nokogiri * All Salmon slaps now use Ox instead of Nokogiri. No touch from status on account
2017-04-06Fix wrong pubsub channel on public timelinesEugen Rochko
2017-04-06Fix notifications delivered to wrong pubsub channel, optimized ↵Eugen Rochko
RemoveStatusService, slightly optimized FanOutOnWriteService again
2017-04-05Split SalmonWorker into smaller parts, move profile updating into another jobEugen Rochko
2017-04-05Replace calls to FeedManager#inline_render and #broadcastEugen Rochko
2017-04-05Only render public payload once in FanOutOnWriteEugen Rochko
2017-04-04Spawn FeedInsertWorker to deliver status into personal feedEugen Rochko
2017-04-04Reduce number of items in feeds, optimize regeneration worker slightly,Eugen Rochko
make regeneration worker unique, (only schedule/execute once at a time)
2017-04-03Add check for visibility.nil? even though it can't ever be, to check for ↵Eugen Rochko
race conditions
2017-04-03Make default admin UI page reports. Add admin UI for creating a domain blockEugen Rochko
2017-04-02Fix issue with feed merge-in code as wellEugen Rochko
2017-04-02Fix feed regeneration bugEugen Rochko
2017-03-31Fix reworked searchEugen Rochko
2017-03-22Prettier account and stream entry URLsEugen Rochko