about summary refs log tree commit diff
path: root/spec/models
AgeCommit message (Collapse)Author
2017-06-08Fix db:seed - only run some validations when the field was changed (#3592)Eugen Rochko
* Fix db:seed - only run some validations when the field was changed * Add tests
2017-06-08Improve RuboCop rules (compatibility to Code Climate) (#3636)Yamagishi Kazutoshi
https://github.com/codeclimate/codeclimate-rubocop/blob/08f8de84ebfb39caa96391e23816877278f6441c/Gemfile.lock#L38 Code Climate is using RuboCop v0.46.0. Change several rules to maintain compatibility.
2017-06-07Use "match_array" only for order independent assertions (#3626)unarist
2017-06-06Fix tag search order and not to use tsvector (#3611)unarist
* Sort results by the name * Switch search method to simple `LIKE` matching instead of tsvector/tsquery Previously we used scores from ts_rank_cd() to sort results, but it didn't work because the function returns same score for all results. It's not for calculate similarity of single words. Sometimes this bug even push out exact matching tag from results. Additionally, PostgreSQL supports prefix searching with standard btree index. Using it offers simpler code, but also less index size and some speed.
2017-06-05Introduce StatusThreadingConcern (#3490)Matt Jankowski
* Add a StatusFilter class to identify visibility of statuses by accounts * Extract StatusThreadingConcern from Status * Clarify purpose of checking for nil account
2017-06-05Added support for configurable reserved usernames (fix of #1382) (#3566)Eugen Rochko
* Added support for configurable reserved usernames * Added reserved usernames from mastodon issue 1355 * Fix reserved usernames
2017-06-04Spec ScopedSettings (#3559)Akihiko Odaki (@fn_aki@pawoo.net)
2017-06-01Handle nil and blank cases in Account finders (#3500)Matt Jankowski
2017-05-31Expand spec coverage and refactor the `Account.find_` methods (#3485)Matt Jankowski
* Move specs for account finder methods to concern spec * Move account finder methods to concern * Improve spec wording * Use more explicit comparison to ensure correct return value * Add coverage for .find_local! and .find_remote! * Add some methods to the finder * Use arel on matching_username method * Avoid ternary in matching domain method * Simplify finder methods * Use an AccountFinder class to simplify lookup
2017-05-30Refactor User and spec (#3431)Akihiko Odaki
* Protect send_devise_notification of User * Improve spec for User
2017-05-29Extract authorization policy for viewing statuses (#3150)Jack Jennings
2017-05-23Introduce recent to Follow (#3247)Akihiko Odaki
Introduce recent to Follow, as Account and other models have. This change also adds specs for the scope and the dependents.
2017-05-22Add coverage for ReportFilter and AccountFilter (#3236)Matt Jankowski
2017-05-20Filter languages with opt out (#3175)Matt Jankowski
* Remove allowed_languages and add filtered_languages * Use filtered_languages instead of allowed_languages
2017-05-20More tests for public timeline method (#3171)Eugen Rochko
2017-05-19Account domain blocks (#2381)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. * Conversation muting - prevents notifications that reference a conversation (including replies, favourites, reblogs) from being created. API endpoints /api/v1/statuses/:id/mute and /api/v1/statuses/:id/unmute Currently no way to tell when a status/conversation is muted, so the web UI only has a "disable notifications" button, doesn't work as a toggle * Display "Dismiss notifications" on all statuses in notifications column, not just own * Add "muted" as a boolean attribute on statuses JSON For now always false on contained reblogs, since it's only relevant for statuses returned from the notifications endpoint, which are not nested Remove "Disable notifications" from detailed status view, since it's only relevant in the notifications column * Up max class length * Remove pending test for conversation mute * Add tests, clean up * Rename to "mute conversation" and "unmute conversation" * Raise validation error when trying to mute/unmute status without conversation * Adding account domain blocks that filter notifications and public timelines * Add tests for domain blocks in notifications, public timelines Filter reblogs of blocked domains from home * Add API for listing and creating account domain blocks * API for creating/deleting domain blocks, tests for Status#ancestors and Status#descendants, filter domain blocks from them * Filter domains in streaming API * Update account_domain_block_spec.rb
2017-05-16Improve Account#triadic_closures (#3079)alpaca-tc
2017-05-16Optimize Status#permitted_for 24x (#3069)alpaca-tc
* Build query with arel node * Add spec for current Status#permitted_for implementation * Refactor status.rb * Order by visibility to optimize query
2017-05-15Feature conversations muting (#3017)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. * Conversation muting - prevents notifications that reference a conversation (including replies, favourites, reblogs) from being created. API endpoints /api/v1/statuses/:id/mute and /api/v1/statuses/:id/unmute Currently no way to tell when a status/conversation is muted, so the web UI only has a "disable notifications" button, doesn't work as a toggle * Display "Dismiss notifications" on all statuses in notifications column, not just own * Add "muted" as a boolean attribute on statuses JSON For now always false on contained reblogs, since it's only relevant for statuses returned from the notifications endpoint, which are not nested Remove "Disable notifications" from detailed status view, since it's only relevant in the notifications column * Up max class length * Remove pending test for conversation mute * Add tests, clean up * Rename to "mute conversation" and "unmute conversation" * Raise validation error when trying to mute/unmute status without conversation
2017-05-13Fixes NoMethodError: undefined method 'first' for nil:NilClass (#3036)alpaca-tc
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-11Add specs for current Status#permitted? implementation (#2982)Jack Jennings
2017-05-08Improve allowed language handling (#2897)Matt Jankowski
* Dont allow empty value in user allowed languages * Sanitize language input to reject blank values in array
2017-05-06Stream entry specs and refactor to use delegate (#2827)Matt Jankowski
* Add coverage for stream entry delegated methods * Use delegate with allow_nil to clean up stream entry
2017-05-05Misc spec coverage improvements (#2821)Matt Jankowski
* Dont use raise_error by itself (avoids warning) * Add coverage for AccountFilter * Improve coverage and refactor for Subscription#lease_seconds * Improve coverage and refactor for NotificationMailer * Simplify assignment of min/max threshold on subscription
2017-05-05use Twitter::Extractor for creating links (#2502)masarakki
2017-05-02Add option to disable two factor auth in admin accounts panel. (#2584)Kaylee
* Add option to disable two factor auth in admin accounts panel. Closes #2578 * Add @mjankowski's suggestions. * Moves destroy actions behind User#disable_two_factor! * Adds spec coverage for Admin:TwoFactorAuthenticationsController and User#disable_two_factor!
2017-05-02Fix subscription expiration condition (#2715)Yamagishi Kazutoshi
* Fix subscription expiration condition * dry and add spec
2017-05-01Filter on allowed user language preferences (#2361)Matt Jankowski
* Naive approached to timeline filtering * Convert allowed_languages into a db column * Allow users to choose languages to see statuses in * Style list items as two columns * Add a hint to explain language filtering preference
2017-04-30Reports spec for media attachments, clean up method (#2660)Matt Jankowski
* Add coverage for Report#media_attachments * Direct query on media attachment
2017-04-30Revert "Use PostgreSQL inheritance for blocks and mutes (#2520)" (#2634)Akihiko Odaki
This reverts commit 5135d609b774b177d3d3894b176a822d86b73d3c.
2017-04-30Use PostgreSQL inheritance for blocks and mutes (#2520)Akihiko Odaki
2017-04-29Add tests to the Feed model (#2594)Joël Quenneville
This adds a test for the `Feed#get` method. While the data transformations in `Feed#get` may seem redundant, they are important to maintain the order from Redis. The tests I wrote will fail if someone tries to refactor away this "redundancy" (as I tried to do in the first iteration of this change).
2017-04-28More status specs (#2564)Matt Jankowski
* Add rough outline of coverage needed for public timeline * Specs for visibility, replies, boosts * Specs for silenced account * Specs for local_only option * Specs for blocks and mutes * Add tentative spec around including other silenced account statuses * Add with_public_visibility scope * Add simple coverage for tag_timeline * Tag timeline includes replies * Replace tag.statuses with a tagged_with scope in tag timeline method * Use with_public_visibility in tag timeline * Extract common scope between public and tag timelines to method * Extract local domain check to local_only scope * Extract local_only check to starting scope method * Move list of excluded from timeline account ids to account model * Simplify excluded accounts list on account model * Only join accounts when needed * Rename method for account specific filtering * Extract method for account exclusions * Fix bug where silenced accounts were not including statuses from other silenced accounts * DRY up filter application from account or no account * timeline_scope can be private * Add spec showing that account can find its excluded accounts ids * Add spec which fails if local_only does not have a left outer join * rubocop
2017-04-26Add spec for Status.as_home_timeline (#2451)Matt Jankowski
2017-04-26Add media dimensions (#2448)Francis Chong
* Fixes #1985 - add migration AddMediaAttachmentMeta, which add meta field to media_attachments - before saving attachment, set file meta if needed - add meta in api * add spec * align the “size” format for image and video * fix code climate * fixes media_attachment_spec.rb
2017-04-26Stricter whitelist rules (#2213)Guillaume Lo Re
* Stricter whitelist rules * Linting * Added spec for blacklisting * Test subdomain blacklist on domain whitelist * No need to split * Change spec name
2017-04-24Add more FeedManager#filter? tests (#2413)Eugen
2017-04-23Admin UI for confirming users (#2245)Ash Furrow
* Shows confirmed status in list. * Adds ability to confirm users in admin UI. * Added new english translations. * Addresses feedback from #2245. * More feedback.
2017-04-21User settings mutation (#2270)Matt Jankowski
* Add user spec for settings, highlight global default mutation issue * Fix mutation issue caused by settings/preferences spec
2017-04-19Fix #2108 - Fix gif uploads (#2171)Eugen
* Fix #2108 - Fix gif uploads Add specs for media attachment gifv conversion * Add ffmpeg to travis * Make travis install ffmpeg, not libav * Switch travis to trusty
2017-04-18Instances list in admin (#2095)Matt Jankowski
* Add admin/instances index action * Add link to instances admin page * View lists instances * Instances, grouped by domain, ordered by count * Use Account.remote scope * Extract method: Account.by_domain_accounts
2017-04-18Admin reports with accounts (#2092)Matt Jankowski
* Add a ReportFilter class * Add reports and targeted_reports relationships to Account * Use ReportFilter from admin/reports controller * Link to admin/reports filtered views from admin account show view * Add indexes to reports.account_id and reports.target_account_id
2017-04-18Remove unused methods (#1730)Matt Jankowski
* Remove unused method #set_counters_maps from api controller * Remove unused method #set_account_counters_maps from api controller * Remove unused method Account#followers_domains * Remove unused User.prolific scope * Add mastodon:users:admins task to list all admin emails * Use interpolated query style in Account.triadic_closures * Coverage for Account.triadic_closures
2017-04-15Add recovery code support for two-factor auth (#1773)Patrick Figel
* Add recovery code support for two-factor auth When users enable two-factor auth, the app now generates ten single-use recovery codes. Users are encouraged to print the codes and store them in a safe place. The two-factor prompt during login now accepts both OTP codes and recovery codes. The two-factor settings UI allows users to regenerated lost recovery codes. Users who have set up two-factor auth prior to this feature being added can use it to generate recovery codes for the first time. Fixes #563 and fixes #987 * Set OTP_SECRET in test enviroment * add missing .html to view file names
2017-04-14Admin reports controller improvements (#1714)Matt Jankowski
* Simplify admin/reports controller filtering for index * Rename parameter to resolved * Fix issue where reports view could not access filter_link_to * Add coverage for admin/reports controller * DRY up resolution of related reports for target account * Clean up admin/reports routes * Add Report#statuses method * DRY up current account action taken params * Rubocop styles
2017-04-13Fix csv export coverage in export spec (#1691)Matt Jankowski
2017-04-13Admin accounts controller cleanup (#1664)Matt Jankowski
* Remove unused account_params method in admin/accounts controller * Introduce AccountFilter to find accounts * Use AccountFilter in admin/accounts controller * Use more restful routes admin silence and suspension area * Add admin/silences and admin/suspensions controllers
2017-04-13Remove pending specs for methods that dont exist (#1658)Matt Jankowski
* Remote spec for non-existent entry_classes helper method This method no longer exists, and is handled by a local variable in a partial instead. * Remove spec for non-existent Account#ping! method
2017-04-11Refactor exports controller (#1567)Matt Jankowski
* Add basic coverage for settings/exports controller * Remove unused @account variable from settings/exports controller * Add coverage for download export actions * Remove deprecated `render :text` in favor of `send_data` for csv downloads * Add model to handle exports * Use Export class in settings/exports controller * Simplify settings/exports controller methods * Move settings/export to more restful routes