mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-15 15:44:56 +01:00
64aac30733
- Change audio files to not be stripped of metadata - Automatically extract cover art from audio if it exists - Add `thumbnail` parameter to `POST /api/v1/media`, `POST /api/v2/media` and `PUT /api/v1/media/:id` - Add `icon` to represent it in attachments in ActivityPub - Fix `preview_url` containing URL of missing missing image when there is no thumbnail instead of null - Fix duration of audio not being displayed on public pages until the file is loaded
33 lines
713 B
Ruby
33 lines
713 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Settings
|
|
class PicturesController < BaseController
|
|
before_action :authenticate_user!
|
|
before_action :set_account
|
|
before_action :set_picture
|
|
|
|
def destroy
|
|
if valid_picture?
|
|
msg = I18n.t('generic.changes_saved_msg') if UpdateAccountService.new.call(@account, { @picture => nil, "#{@picture}_remote_url" => '' })
|
|
redirect_to settings_profile_path, notice: msg, status: 303
|
|
else
|
|
bad_request
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def set_account
|
|
@account = current_account
|
|
end
|
|
|
|
def set_picture
|
|
@picture = params[:id]
|
|
end
|
|
|
|
def valid_picture?
|
|
%w(avatar header).include?(@picture)
|
|
end
|
|
end
|
|
end
|