From 564efd06515edc524a8a1cdf7a3d8a7d9a376c04 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 14 Feb 2022 21:27:53 +0100 Subject: Add appeals (#17364) * Add appeals * Add ability to reject appeals and ability to browse pending appeals in admin UI * Add strikes to account page in settings * Various fixes and improvements - Add separate notification setting for appeals, separate from reports - Fix style of links in report/strike header - Change approving an appeal to not restore statuses (due to federation complexities) - Change style of successfully appealed strikes on account settings page - Change account settings page to only show unappealed or recently appealed strikes * Change appealed_at to overruled_at * Fix missing method error --- spec/models/appeal_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 spec/models/appeal_spec.rb (limited to 'spec/models') diff --git a/spec/models/appeal_spec.rb b/spec/models/appeal_spec.rb new file mode 100644 index 000000000..14062dc4f --- /dev/null +++ b/spec/models/appeal_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Appeal, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end -- cgit From 2fd2666eea571737fa689a2808b3e5f8786701f0 Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Wed, 16 Feb 2022 21:14:53 +0900 Subject: Add test for user matching ip (#17572) --- spec/models/user_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spec/models') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 406438c22..1645ab59e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -89,6 +89,19 @@ RSpec.describe User, type: :model do expect(User.matches_email('specified')).to match_array([specified]) end end + + describe 'matches_ip' do + it 'returns a relation of users whose ip address is matching with the given CIDR' do + user1 = Fabricate(:user) + user2 = Fabricate(:user) + Fabricate(:session_activation, user: user1, ip: '2160:2160::22', session_id: '1') + Fabricate(:session_activation, user: user1, ip: '2160:2160::23', session_id: '2') + Fabricate(:session_activation, user: user2, ip: '2160:8888::24', session_id: '3') + Fabricate(:session_activation, user: user2, ip: '2160:8888::25', session_id: '4') + + expect(User.matches_ip('2160:2160::/32')).to match_array([user1]) + end + end end let(:account) { Fabricate(:account, username: 'alice') } -- cgit From 73f5e4a1d9c6d067ff62c5cc9a65d929a56f0f00 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Tue, 22 Feb 2022 14:14:17 -0500 Subject: Fix various typos (#17621) Found via `codespell -q 3 -S ./CHANGELOG.md,./AUTHORS.md,./config/locales,./app/javascript/mastodon/locales -L ba,keypair,medias,ro` --- app/javascript/mastodon/components/loading_indicator.js | 2 +- app/javascript/mastodon/features/emoji/emoji_compressed.js | 2 +- app/lib/feed_manager.rb | 2 +- app/services/fetch_link_card_service.rb | 2 +- app/services/notify_service.rb | 2 +- config/initializers/preload_link_headers.rb | 2 +- db/migrate/20170920032311_fix_reblogs_in_feeds.rb | 2 +- .../two_factor_authentication/otp_authentication_controller_spec.rb | 2 +- spec/models/web/push_subscription_spec.rb | 2 +- spec/services/block_domain_service_spec.rb | 2 +- spec/services/clear_domain_media_service_spec.rb | 2 +- spec/services/delete_account_service_spec.rb | 2 +- spec/validators/unreserved_username_validator_spec.rb | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) (limited to 'spec/models') diff --git a/app/javascript/mastodon/components/loading_indicator.js b/app/javascript/mastodon/components/loading_indicator.js index 59f721c50..33c59d94c 100644 --- a/app/javascript/mastodon/components/loading_indicator.js +++ b/app/javascript/mastodon/components/loading_indicator.js @@ -6,7 +6,7 @@ export const CircularProgress = ({ size, strokeWidth }) => { const radius = (size - strokeWidth) / 2; return ( - + { let { short_names, search, unified } = emojiMartData.emojis[key]; if (short_names[0] !== key) { - throw new Error('The compresser expects the first short_code to be the ' + + throw new Error('The compressor expects the first short_code to be the ' + 'key. It may need to be rewritten if the emoji change such that this ' + 'is no longer the case.'); } diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index ccd4d3610..fc35292f2 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -491,7 +491,7 @@ class FeedManager end else # A reblog may reach earlier than the original status because of the - # delay of the worker deliverying the original status, the late addition + # delay of the worker delivering the original status, the late addition # by merging timelines, and other reasons. # If such a reblog already exists, just do not re-insert it into the feed. return false unless redis.zscore(reblog_key, status.id).nil? diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index 94dc6389f..239ab9b93 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -2,7 +2,7 @@ class FetchLinkCardService < BaseService URL_PATTERN = %r{ - (#{Twitter::TwitterText::Regex[:valid_url_preceding_chars]}) # $1 preceeding chars + (#{Twitter::TwitterText::Regex[:valid_url_preceding_chars]}) # $1 preceding chars ( # $2 URL (https?:\/\/) # $3 Protocol (required) (#{Twitter::TwitterText::Regex[:valid_domain]}) # $4 Domain(s) diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 039e007f5..ab80a7e4b 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -71,7 +71,7 @@ class NotifyService < BaseService message? && @notification.target_status.direct_visibility? end - # Returns true if the sender has been mentionned by the recipient up the thread + # Returns true if the sender has been mentioned by the recipient up the thread def response_to_recipient? return false if @notification.target_status.in_reply_to_id.nil? diff --git a/config/initializers/preload_link_headers.rb b/config/initializers/preload_link_headers.rb index 9f21c45ec..364a7cc1b 100644 --- a/config/initializers/preload_link_headers.rb +++ b/config/initializers/preload_link_headers.rb @@ -2,7 +2,7 @@ # in the Links header per default. # In our case, that will bloat headers too much and potentially cause -# issues with reverse proxies. Furhermore, we don't need those links, +# issues with reverse proxies. Furthermore, we don't need those links, # as we already output them as HTML link tags. Rails.application.config.action_view.preload_links_header = false diff --git a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb index 5654bf6f8..bcd4b9137 100644 --- a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb +++ b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb @@ -15,7 +15,7 @@ class FixReblogsInFeeds < ActiveRecord::Migration[5.1] # feed, with an entry in a reblog tracking zset (where the score # is once again set to the reblogging status' ID, and the value # is set to the reblogged status' ID). This is safe for Redis' - # float coersion because in this reblog tracking zset, we only + # float conversion because in this reblog tracking zset, we only # need the rebloggging status' ID to be able to stop tracking # entries after they have gotten too far down the feed, which # does not require an exact value. diff --git a/spec/controllers/settings/two_factor_authentication/otp_authentication_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/otp_authentication_controller_spec.rb index 17e8fa9b8..c8ba6f9a8 100644 --- a/spec/controllers/settings/two_factor_authentication/otp_authentication_controller_spec.rb +++ b/spec/controllers/settings/two_factor_authentication/otp_authentication_controller_spec.rb @@ -18,7 +18,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController do user.update(otp_required_for_login: true) end - it 'redirects to two factor authentciation methods list page' do + it 'redirects to two factor authentication methods list page' do get :show expect(response).to redirect_to settings_two_factor_authentication_methods_path diff --git a/spec/models/web/push_subscription_spec.rb b/spec/models/web/push_subscription_spec.rb index b44904369..bd5719593 100644 --- a/spec/models/web/push_subscription_spec.rb +++ b/spec/models/web/push_subscription_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Web::PushSubscription, type: :model do context "when notification is a #{type}" do let(:notification_type) { type } - it "returns boolean corresonding to alert setting" do + it "returns boolean corresponding to alert setting" do expect(subject.pushable?(notification)).to eq data[:alerts][type] end end diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb index c689b57e3..242b02fff 100644 --- a/spec/services/block_domain_service_spec.rb +++ b/spec/services/block_domain_service_spec.rb @@ -66,7 +66,7 @@ RSpec.describe BlockDomainService, type: :service do expect(Account.find_remote('badguy', 'evil.org').silenced_at).to_not eq DomainBlock.find_by(domain: 'evil.org').created_at end - it 'leaves the domains status and attachements, but clears media' do + it 'leaves the domains status and attachments, but clears media' do expect { bad_status1.reload }.not_to raise_error expect { bad_status2.reload }.not_to raise_error expect { bad_attachment.reload }.not_to raise_error diff --git a/spec/services/clear_domain_media_service_spec.rb b/spec/services/clear_domain_media_service_spec.rb index 8e58c6039..45b92e2c9 100644 --- a/spec/services/clear_domain_media_service_spec.rb +++ b/spec/services/clear_domain_media_service_spec.rb @@ -13,7 +13,7 @@ RSpec.describe ClearDomainMediaService, type: :service do subject.call(DomainBlock.create!(domain: 'evil.org', severity: :silence, reject_media: true)) end - it 'leaves the domains status and attachements, but clears media' do + it 'leaves the domains status and attachments, but clears media' do expect { bad_status1.reload }.not_to raise_error expect { bad_status2.reload }.not_to raise_error expect { bad_attachment.reload }.not_to raise_error diff --git a/spec/services/delete_account_service_spec.rb b/spec/services/delete_account_service_spec.rb index b1da97036..9c785fc17 100644 --- a/spec/services/delete_account_service_spec.rb +++ b/spec/services/delete_account_service_spec.rb @@ -90,7 +90,7 @@ RSpec.describe DeleteAccountService, type: :service do let!(:account) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', protocol: :activitypub) } let!(:local_follower) { Fabricate(:account) } - it 'sends a reject follow to follwer inboxes' do + it 'sends a reject follow to follower inboxes' do subject.call expect(a_request(:post, account.inbox_url)).to have_been_made.once end diff --git a/spec/validators/unreserved_username_validator_spec.rb b/spec/validators/unreserved_username_validator_spec.rb index cabd6d386..746b3866c 100644 --- a/spec/validators/unreserved_username_validator_spec.rb +++ b/spec/validators/unreserved_username_validator_spec.rb @@ -27,7 +27,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do context 'reserved_username?' do let(:reserved_username) { true } - it 'calls erros.add' do + it 'calls errors.add' do expect(errors).to have_received(:add).with(:username, :reserved) end end @@ -35,7 +35,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do context '!reserved_username?' do let(:reserved_username) { false } - it 'not calls erros.add' do + it 'not calls errors.add' do expect(errors).not_to have_received(:add).with(:username, any_args) end end -- cgit