Merge commit '9f078e238d' into kb_migration

This commit is contained in:
KMY 2023-07-08 11:28:29 +09:00
commit 01e57e84ac
7 changed files with 26 additions and 6 deletions
Gemfile.lock
app
javascript
mastodon/components
styles
contrast
mastodon
models/concerns
spec
fixtures/files
requests/api/v2

View file

@ -432,7 +432,7 @@ GEM
net-protocol net-protocol
net-ssh (7.1.0) net-ssh (7.1.0)
nio4r (2.5.9) nio4r (2.5.9)
nokogiri (1.15.2) nokogiri (1.15.3)
mini_portile2 (~> 2.8.2) mini_portile2 (~> 2.8.2)
racc (~> 1.4) racc (~> 1.4)
oj (3.15.0) oj (3.15.0)
@ -628,7 +628,7 @@ GEM
fugit (~> 1.1, >= 1.1.6) fugit (~> 1.1, >= 1.1.6)
safety_net_attestation (0.4.0) safety_net_attestation (0.4.0)
jwt (~> 2.0) jwt (~> 2.0)
sanitize (6.0.1) sanitize (6.0.2)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
scenic (1.7.0) scenic (1.7.0)

View file

@ -44,7 +44,7 @@ class TranslateButton extends PureComponent {
} }
return ( return (
<button className='status__content__read-more-button' onClick={onClick}> <button className='status__content__translate-button' onClick={onClick}>
<FormattedMessage id='status.translate' defaultMessage='Translate' /> <FormattedMessage id='status.translate' defaultMessage='Translate' />
</button> </button>
); );

View file

@ -15,7 +15,8 @@
.status__content a, .status__content a,
.link-footer a, .link-footer a,
.reply-indicator__content a, .reply-indicator__content a,
.status__content__read-more-button { .status__content__read-more-button,
.status__content__translate-button {
text-decoration: underline; text-decoration: underline;
&:hover, &:hover,

View file

@ -991,7 +991,8 @@ body > [data-popper-placement] {
max-height: 22px * 15; // 15 lines is roughly above 500 characters max-height: 22px * 15; // 15 lines is roughly above 500 characters
} }
.status__content__read-more-button { .status__content__read-more-button,
.status__content__translate-button {
display: block; display: block;
font-size: 15px; font-size: 15px;
line-height: 22px; line-height: 22px;

View file

@ -24,7 +24,7 @@ module Attachmentable
def self.has_attached_file(name, options = {}) # rubocop:disable Naming/PredicateName def self.has_attached_file(name, options = {}) # rubocop:disable Naming/PredicateName
super(name, options) super(name, options)
send(:"before_#{name}_validate") do send(:"before_#{name}_validate", prepend: true) do
attachment = send(name) attachment = send(name)
check_image_dimension(attachment) check_image_dimension(attachment)
set_file_content_type(attachment) set_file_content_type(attachment)

Binary file not shown.

After

(image error) Size: 60 KiB

View file

@ -0,0 +1,18 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Media API', paperclip_processing: true do
let(:user) { Fabricate(:user) }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
let(:scopes) { 'write' }
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
describe 'POST /api/v2/media' do
it 'returns http success' do
post '/api/v2/media', headers: headers, params: { file: fixture_file_upload('attachment-jpg.123456_abcd', 'image/jpeg') }
expect(File.exist?(user.account.media_attachments.first.file.path(:small))).to be true
expect(response).to have_http_status(200)
end
end
end