Skip to content
Snippets Groups Projects
Commit 1a12fd14 authored by Eugen's avatar Eugen Committed by GitHub
Browse files

Merge branch 'master' into master

parents a18fd491 282bb55c
No related branches found
No related tags found
No related merge requests found
---
bg:
simple_form:
hints:
defaults:
avatar: PNG, GIF или JPG. До 2MB. Ще бъде смалена до 120x120 пиксела
display_name: До 30 символа
header: PNG, GIF или JPG. До 2MB. Ще бъде смалена до 700x335 пиксела
locked: Изисква ръчно одобрение на последователите. По подразбиране, публикациите са достъпни само до последователи.
note: До 160 символа
imports:
data: CSV файл, експортиран от друга инстанция на Mastodon
labels:
defaults:
avatar: Аватар
confirm_new_password: Потвърди новата парола
confirm_password: Потвърди паролата
current_password: Текуща парола
data: Данни
display_name: Показвано име
email: E-mail адрес
header: Заглавен ред
locale: Език
locked: Направи акаунта поверителен
new_password: Нова парола
note: Био
otp_attempt: Двустепенен код
password: Парола
setting_default_privacy: Поверителност на публикациите
type: Тип на импортиране
username: Потребителско име
interactions:
must_be_follower: Блокирай известия от не-последователи
must_be_following: Блокирай известия от хора, които не следваш
notification_emails:
digest: Изпращай извлечения на съобщенията
favourite: Изпращай e-mail, когато някой хареса твоя публикация
follow: Изпращай e-mail, когато някой те последва
follow_request: Изпращай e-mail, когато някой пожелае да те последва
mention: Изпращай e-mail, когато някой те спомене
reblog: Изпращай e-mail, когато някой сподели твоя публикация
'no': 'Не'
required:
mark: "*"
text: задължително
'yes': 'Да'
......@@ -26,7 +26,7 @@ ru:
note: О Вас
otp_attempt: Двухфакторный код
password: Пароль
setting_default_privacy: Приватность постов
setting_default_privacy: Видимость постов
type: Тип импорта
username: Имя пользователя
interactions:
......
# frozen_string_literal: true
require 'sidekiq/web'
......@@ -14,8 +15,8 @@ Rails.application.routes.draw do
controllers authorizations: 'oauth/authorizations', authorized_applications: 'oauth/authorized_applications'
end
get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger, defaults: { format: 'json' }
get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger, defaults: { format: 'json' }
devise_for :users, path: 'auth', controllers: {
sessions: 'auth/sessions',
......@@ -89,12 +90,8 @@ Rails.application.routes.draw do
end
resources :accounts, only: [:index, :show] do
member do
post :silence
post :unsilence
post :suspend
post :unsuspend
end
resource :silence, only: [:create, :destroy]
resource :suspension, only: [:create, :destroy]
end
end
......
require 'rails_helper'
describe Admin::SilencesController do
let(:account) { Fabricate(:account) }
before do
sign_in Fabricate(:user, admin: true), scope: :user
end
describe 'POST #create' do
it 'redirects to admin accounts page' do
post :create, params: { account_id: account.id }
expect(response).to redirect_to(admin_accounts_path)
end
end
describe 'DELETE #destroy' do
it 'redirects to admin accounts page' do
delete :destroy, params: { account_id: account.id }
expect(response).to redirect_to(admin_accounts_path)
end
end
end
require 'rails_helper'
describe Admin::SuspensionsController do
let(:account) { Fabricate(:account) }
before do
sign_in Fabricate(:user, admin: true), scope: :user
end
describe 'POST #create' do
it 'redirects to admin accounts page' do
post :create, params: { account_id: account.id }
expect(response).to redirect_to(admin_accounts_path)
end
end
describe 'DELETE #destroy' do
it 'redirects to admin accounts page' do
delete :destroy, params: { account_id: account.id }
expect(response).to redirect_to(admin_accounts_path)
end
end
end
require 'rails_helper'
describe Settings::ExportsController do
render_views
before do
sign_in Fabricate(:user), scope: :user
end
......@@ -8,6 +10,7 @@ describe Settings::ExportsController do
describe 'GET #show' do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
end
end
......
require 'rails_helper'
describe WellKnown::HostMetaController, type: :controller do
render_views
describe 'GET #show' do
it 'returns http success' do
get :show, format: :xml
expect(response).to have_http_status(:success)
end
end
end
require 'rails_helper'
RSpec.describe XrdController, type: :controller do
describe WellKnown::WebfingerController, type: :controller do
render_views
describe 'GET #host_meta' do
it 'returns http success' do
get :host_meta
expect(response).to have_http_status(:success)
end
end
describe 'GET #webfinger' do
describe 'GET #show' do
let(:alice) { Fabricate(:account, username: 'alice') }
it 'returns http success when account can be found' do
get :webfinger, params: { resource: alice.to_webfinger_s }, format: :json
get :show, params: { resource: alice.to_webfinger_s }, format: :json
expect(response).to have_http_status(:success)
end
it 'returns http not found when account cannot be found' do
get :webfinger, params: { resource: 'acct:not@existing.com' }, format: :json
get :show, params: { resource: 'acct:not@existing.com' }, format: :json
expect(response).to have_http_status(:not_found)
end
end
......
require 'rails_helper'
describe AccountFilter do
describe 'with empty params' do
it 'defaults to alphabetic account list' do
filter = AccountFilter.new({})
expect(filter.results).to eq Account.alphabetic
end
end
describe 'with invalid params' do
it 'raises with key error' do
filter = AccountFilter.new(wrong: true)
expect { filter.results }.to raise_error(/wrong/)
end
end
describe 'with valid params' do
it 'combines filters on Account' do
filter = AccountFilter.new(by_domain: 'test.com', silenced: true)
allow(Account).to receive(:where).and_return(Account.none)
allow(Account).to receive(:silenced).and_return(Account.none)
filter.results
expect(Account).to have_received(:where).with(domain: 'test.com')
expect(Account).to have_received(:silenced)
end
end
end
require "rails_helper"
describe "The host_meta route" do
describe "requested without accepts headers" do
it "returns an xml response" do
get host_meta_url
expect(response).to have_http_status(:success)
expect(response.content_type).to eq "application/xrd+xml"
end
end
end
require 'rails_helper'
describe 'the host-meta route' do
it 'routes to correct place with xml format' do
expect(get('/.well-known/host-meta')).
to route_to('well_known/host_meta#show', format: 'xml')
end
end
describe 'the webfinger route' do
it 'routes to correct place with json format' do
expect(get('/.well-known/webfinger')).
to route_to('well_known/webfinger#show', format: 'json')
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment