mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-12 06:06:22 +01:00
Merge commit 'c07cca4727041ea5a5721acbc603d4bfb45a15a6' into glitch-soc/merge-upstream
Unlike upstream, kept the direct timeline endpoint, as it is still of use in glitch-soc.
This commit is contained in:
commit
7039dca12c
@ -5,8 +5,8 @@ class Api::V1::StatusesController < Api::BaseController
|
|||||||
|
|
||||||
before_action -> { authorize_if_got_token! :read, :'read:statuses' }, except: [:create, :destroy]
|
before_action -> { authorize_if_got_token! :read, :'read:statuses' }, except: [:create, :destroy]
|
||||||
before_action -> { doorkeeper_authorize! :write, :'write:statuses' }, only: [:create, :destroy]
|
before_action -> { doorkeeper_authorize! :write, :'write:statuses' }, only: [:create, :destroy]
|
||||||
before_action :require_user!, except: [:show, :context, :card]
|
before_action :require_user!, except: [:show, :context]
|
||||||
before_action :set_status, only: [:show, :context, :card]
|
before_action :set_status, only: [:show, :context]
|
||||||
|
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
@ -33,16 +33,6 @@ class Api::V1::StatusesController < Api::BaseController
|
|||||||
render json: @context, serializer: REST::ContextSerializer, relationships: StatusRelationshipsPresenter.new(statuses, current_user&.account_id)
|
render json: @context, serializer: REST::ContextSerializer, relationships: StatusRelationshipsPresenter.new(statuses, current_user&.account_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def card
|
|
||||||
@card = @status.preview_cards.first
|
|
||||||
|
|
||||||
if @card.nil?
|
|
||||||
render_empty
|
|
||||||
else
|
|
||||||
render json: @card, serializer: REST::PreviewCardSerializer
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@status = PostStatusService.new.call(current_user.account,
|
@status = PostStatusService.new.call(current_user.account,
|
||||||
text: status_params[:status],
|
text: status_params[:status],
|
||||||
|
@ -118,7 +118,10 @@ class ComposeForm extends ImmutablePureComponent {
|
|||||||
|
|
||||||
handleFocus = () => {
|
handleFocus = () => {
|
||||||
if (this.composeForm && !this.props.singleColumn) {
|
if (this.composeForm && !this.props.singleColumn) {
|
||||||
this.composeForm.scrollIntoView();
|
const { left, right } = this.composeForm.getBoundingClientRect();
|
||||||
|
if (left < 0 || right > (window.innerWidth || document.documentElement.clientWidth)) {
|
||||||
|
this.composeForm.scrollIntoView();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ class Request
|
|||||||
begin
|
begin
|
||||||
raise Mastodon::HostValidationError if PrivateAddressCheck.private_address?(IPAddr.new(address.to_s))
|
raise Mastodon::HostValidationError if PrivateAddressCheck.private_address?(IPAddr.new(address.to_s))
|
||||||
|
|
||||||
sock = ::Socket.new(::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)
|
sock = ::Socket.new(address.is_a?(Resolv::IPv6) ? ::Socket::AF_INET6 : ::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)
|
||||||
sockaddr = ::Socket.pack_sockaddr_in(port, address.to_s)
|
sockaddr = ::Socket.pack_sockaddr_in(port, address.to_s)
|
||||||
|
|
||||||
sock.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1)
|
sock.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1)
|
||||||
|
@ -17,10 +17,13 @@ class Admin::AccountAction
|
|||||||
:type,
|
:type,
|
||||||
:text,
|
:text,
|
||||||
:report_id,
|
:report_id,
|
||||||
:warning_preset_id,
|
:warning_preset_id
|
||||||
:send_email_notification
|
|
||||||
|
|
||||||
attr_reader :warning
|
attr_reader :warning, :send_email_notification
|
||||||
|
|
||||||
|
def send_email_notification=(value)
|
||||||
|
@send_email_notification = ActiveModel::Type::Boolean.new.cast(value)
|
||||||
|
end
|
||||||
|
|
||||||
def save!
|
def save!
|
||||||
ApplicationRecord.transaction do
|
ApplicationRecord.transaction do
|
||||||
|
@ -299,12 +299,10 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
member do
|
member do
|
||||||
get :context
|
get :context
|
||||||
get :card
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :timelines do
|
namespace :timelines do
|
||||||
resource :direct, only: :show, controller: :direct
|
|
||||||
resource :home, only: :show, controller: :home
|
resource :home, only: :show, controller: :home
|
||||||
resource :public, only: :show, controller: :public
|
resource :public, only: :show, controller: :public
|
||||||
resources :tag, only: :show
|
resources :tag, only: :show
|
||||||
@ -362,7 +360,6 @@ Rails.application.routes.draw do
|
|||||||
resources :notifications, only: [:index, :show, :destroy] do
|
resources :notifications, only: [:index, :show, :destroy] do
|
||||||
collection do
|
collection do
|
||||||
post :clear
|
post :clear
|
||||||
post :dismiss # Deprecated
|
|
||||||
delete :destroy_multiple
|
delete :destroy_multiple
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -91,13 +91,6 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
|
|||||||
expect(response).to have_http_status(404)
|
expect(response).to have_http_status(404)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #card' do
|
|
||||||
it 'returns http unautharized' do
|
|
||||||
get :card, params: { id: status.id }
|
|
||||||
expect(response).to have_http_status(404)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with a public status' do
|
context 'with a public status' do
|
||||||
@ -120,13 +113,6 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
|
|||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #card' do
|
|
||||||
it 'returns http success' do
|
|
||||||
get :card, params: { id: status.id }
|
|
||||||
expect(response).to have_http_status(200)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user