Merge pull request #8417 from SuperTux88/remove-strip_exif-flag
Always strip exif data and drop user setting for it
This commit is contained in:
commit
6510bafa88
18 changed files with 15 additions and 57 deletions
|
|
@ -46,6 +46,7 @@ We use yarn to install the frontend dependencies now, so you need to have that i
|
||||||
* Upgrade to latest `diaspora_federation`, remove support for old federation protocol [#8368](https://github.com/diaspora/diaspora/pull/8368)
|
* Upgrade to latest `diaspora_federation`, remove support for old federation protocol [#8368](https://github.com/diaspora/diaspora/pull/8368)
|
||||||
* Remove support for `therubyracer` [#8337](https://github.com/diaspora/diaspora/issues/8337)
|
* Remove support for `therubyracer` [#8337](https://github.com/diaspora/diaspora/issues/8337)
|
||||||
* Replace `unicorn` with `puma` [#8392](https://github.com/diaspora/diaspora/pull/8392)
|
* Replace `unicorn` with `puma` [#8392](https://github.com/diaspora/diaspora/pull/8392)
|
||||||
|
* Drop `strip_exif` flag and always remove exif data from uploaded images [#8417](https://github.com/diaspora/diaspora/pull/8417)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Fix multiple photos upload progress bar [#7655](https://github.com/diaspora/diaspora/pull/7655)
|
* Fix multiple photos upload progress bar [#7655](https://github.com/diaspora/diaspora/pull/7655)
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,6 @@ class UsersController < ApplicationController
|
||||||
render :edit
|
render :edit
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_privacy_settings
|
|
||||||
privacy_params = params.fetch(:user).permit(:strip_exif)
|
|
||||||
|
|
||||||
if current_user.update(strip_exif: privacy_params[:strip_exif])
|
|
||||||
flash[:notice] = t("users.update.settings_updated")
|
|
||||||
else
|
|
||||||
flash[:error] = t("users.update.settings_not_updated")
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_back fallback_location: privacy_settings_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
|
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
|
||||||
current_user.close_account!
|
current_user.close_account!
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,6 @@ class Photo < ApplicationRecord
|
||||||
photo = new(params.to_hash.stringify_keys.slice(*column_names, "author"))
|
photo = new(params.to_hash.stringify_keys.slice(*column_names, "author"))
|
||||||
photo.random_string = SecureRandom.hex(10)
|
photo.random_string = SecureRandom.hex(10)
|
||||||
|
|
||||||
photo.unprocessed_image.strip_exif = photo.author.owner.strip_exif
|
|
||||||
|
|
||||||
if params[:user_file]
|
if params[:user_file]
|
||||||
image_file = params.delete(:user_file)
|
image_file = params.delete(:user_file)
|
||||||
photo.unprocessed_image.store! image_file
|
photo.unprocessed_image.store! image_file
|
||||||
|
|
|
||||||
|
|
@ -569,7 +569,6 @@ class User < ApplicationRecord
|
||||||
self.remove_export = true
|
self.remove_export = true
|
||||||
self.remove_exported_photos_file = true
|
self.remove_exported_photos_file = true
|
||||||
self[:disable_mail] = true
|
self[:disable_mail] = true
|
||||||
self[:strip_exif] = true
|
|
||||||
self[:email] = "deletedaccount_#{self[:id]}@example.org"
|
self[:email] = "deletedaccount_#{self[:id]}@example.org"
|
||||||
|
|
||||||
random_password = SecureRandom.hex(20)
|
random_password = SecureRandom.hex(20)
|
||||||
|
|
@ -612,7 +611,7 @@ class User < ApplicationRecord
|
||||||
attributes.keys - %w(id username encrypted_password created_at updated_at locked_at
|
attributes.keys - %w(id username encrypted_password created_at updated_at locked_at
|
||||||
serialized_private_key getting_started
|
serialized_private_key getting_started
|
||||||
disable_mail show_community_spotlight_in_stream
|
disable_mail show_community_spotlight_in_stream
|
||||||
strip_exif email remove_after export exporting
|
email remove_after export exporting
|
||||||
exported_photos_file exporting_photos)
|
exported_photos_file exporting_photos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ module Export
|
||||||
:show_community_spotlight_in_stream,
|
:show_community_spotlight_in_stream,
|
||||||
:auto_follow_back,
|
:auto_follow_back,
|
||||||
:auto_follow_back_aspect,
|
:auto_follow_back_aspect,
|
||||||
:strip_exif,
|
|
||||||
:blocks
|
:blocks
|
||||||
has_one :profile, serializer: FederationEntitySerializer
|
has_one :profile, serializer: FederationEntitySerializer
|
||||||
has_many :contact_groups, each_serializer: Export::AspectSerializer
|
has_many :contact_groups, each_serializer: Export::AspectSerializer
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,6 @@
|
||||||
class UnprocessedImage < CarrierWave::Uploader::Base
|
class UnprocessedImage < CarrierWave::Uploader::Base
|
||||||
include CarrierWave::MiniMagick
|
include CarrierWave::MiniMagick
|
||||||
|
|
||||||
attr_accessor :strip_exif
|
|
||||||
|
|
||||||
def strip_exif
|
|
||||||
@strip_exif || false
|
|
||||||
end
|
|
||||||
|
|
||||||
def store_dir
|
def store_dir
|
||||||
"uploads/images"
|
"uploads/images"
|
||||||
end
|
end
|
||||||
|
|
@ -40,7 +34,7 @@ class UnprocessedImage < CarrierWave::Uploader::Base
|
||||||
manipulate! do |img|
|
manipulate! do |img|
|
||||||
img.combine_options do |i|
|
img.combine_options do |i|
|
||||||
i.auto_orient
|
i.auto_orient
|
||||||
i.strip if strip_exif
|
i.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
img = yield(img) if block_given?
|
img = yield(img) if block_given?
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,3 @@
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%h3
|
|
||||||
= t(".title")
|
|
||||||
|
|
||||||
= form_for current_user, url: update_privacy_settings_path, html: {method: :put} do |f|
|
|
||||||
= f.error_messages
|
|
||||||
|
|
||||||
= f.fields_for :stream_preferences do
|
|
||||||
.checkbox#stream_prefs
|
|
||||||
= f.label :strip_exif do
|
|
||||||
= f.check_box :strip_exif
|
|
||||||
= t(".strip_exif")
|
|
||||||
= f.submit t("users.edit.change"), class: "btn btn-primary pull-right"
|
|
||||||
%hr
|
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%h3
|
%h3
|
||||||
|
|
|
||||||
|
|
@ -1331,7 +1331,6 @@ en:
|
||||||
|
|
||||||
privacy_settings:
|
privacy_settings:
|
||||||
title: "Privacy settings"
|
title: "Privacy settings"
|
||||||
strip_exif: "Strip metadata such as location, author, and camera model from uploaded images (recommended)"
|
|
||||||
ignored_users: "Ignored users"
|
ignored_users: "Ignored users"
|
||||||
stop_ignoring: "Stop ignoring"
|
stop_ignoring: "Stop ignoring"
|
||||||
no_user_ignored_message: "You are not currently ignoring any other user"
|
no_user_ignored_message: "You are not currently ignoring any other user"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class RemoveStripExifFromUsers < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
remove_column :users, :strip_exif, :boolean, default: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -123,7 +123,7 @@ class ArchiveImporter
|
||||||
end
|
end
|
||||||
|
|
||||||
def import_settings
|
def import_settings
|
||||||
allowed_keys = %w[language show_community_spotlight_in_stream strip_exif]
|
allowed_keys = %w[language show_community_spotlight_in_stream]
|
||||||
convert_keys(archive_hash["user"], allowed_keys).each do |key, value|
|
convert_keys(archive_hash["user"], allowed_keys).each do |key, value|
|
||||||
user.update(key => value) unless value.nil?
|
user.update(key => value) unless value.nil?
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
"null"
|
"null"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"strip_exif": { "type": "boolean" },
|
|
||||||
"blocks": {
|
"blocks": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ describe Diaspora::Exporter do
|
||||||
user_properties = build_property_hash(
|
user_properties = build_property_hash(
|
||||||
user,
|
user,
|
||||||
%i[email username language disable_mail show_community_spotlight_in_stream auto_follow_back
|
%i[email username language disable_mail show_community_spotlight_in_stream auto_follow_back
|
||||||
auto_follow_back_aspect strip_exif],
|
auto_follow_back_aspect],
|
||||||
private_key: :serialized_private_key
|
private_key: :serialized_private_key
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,5 @@ Jasmine.configure do |config|
|
||||||
config.chrome_cli_options["disable-gpu"] = nil
|
config.chrome_cli_options["disable-gpu"] = nil
|
||||||
config.chrome_cli_options["disable-software-rasterizer"] = nil
|
config.chrome_cli_options["disable-software-rasterizer"] = nil
|
||||||
config.chrome_cli_options["disable-dev-shm-usage"] = nil
|
config.chrome_cli_options["disable-dev-shm-usage"] = nil
|
||||||
|
config.chrome_cli_options["last-parameter-to-open-blank-page-workaround"] = " about:blank"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,6 @@ describe ArchiveImporter do
|
||||||
"contact_groups" => [{
|
"contact_groups" => [{
|
||||||
"name" => "Follow"
|
"name" => "Follow"
|
||||||
}],
|
}],
|
||||||
"strip_exif" => false,
|
|
||||||
"show_community_spotlight_in_stream" => false,
|
"show_community_spotlight_in_stream" => false,
|
||||||
"language" => "ru",
|
"language" => "ru",
|
||||||
"auto_follow_back" => true,
|
"auto_follow_back" => true,
|
||||||
|
|
@ -130,7 +129,6 @@ describe ArchiveImporter do
|
||||||
archive_importer.import
|
archive_importer.import
|
||||||
}.not_to raise_error
|
}.not_to raise_error
|
||||||
|
|
||||||
expect(archive_importer.user.strip_exif).to eq(false)
|
|
||||||
expect(archive_importer.user.show_community_spotlight_in_stream).to eq(false)
|
expect(archive_importer.user.show_community_spotlight_in_stream).to eq(false)
|
||||||
expect(archive_importer.user.language).to eq("ru")
|
expect(archive_importer.user.language).to eq("ru")
|
||||||
expect(archive_importer.user.auto_follow_back).to eq(true)
|
expect(archive_importer.user.auto_follow_back).to eq(true)
|
||||||
|
|
@ -142,7 +140,6 @@ describe ArchiveImporter do
|
||||||
archive_importer.import(import_settings: false)
|
archive_importer.import(import_settings: false)
|
||||||
}.not_to raise_error
|
}.not_to raise_error
|
||||||
|
|
||||||
expect(archive_importer.user.strip_exif).to eq(true)
|
|
||||||
expect(archive_importer.user.show_community_spotlight_in_stream).to eq(true)
|
expect(archive_importer.user.show_community_spotlight_in_stream).to eq(true)
|
||||||
expect(archive_importer.user.language).to eq("en")
|
expect(archive_importer.user.language).to eq("en")
|
||||||
expect(archive_importer.user.auto_follow_back).to eq(false)
|
expect(archive_importer.user.auto_follow_back).to eq(false)
|
||||||
|
|
|
||||||
|
|
@ -147,13 +147,7 @@ describe Photo, :type => :model do
|
||||||
FileUtils.rm_r Dir.glob(File.join(public_path, "uploads/images/*"))
|
FileUtils.rm_r Dir.glob(File.join(public_path, "uploads/images/*"))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should preserve EXIF data in according to user preference" do
|
it "should strip EXIF data" do
|
||||||
image = image_from a_photo_sent_by(alice)
|
|
||||||
|
|
||||||
expect(image.exif.length).not_to eq(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should not preserve EXIF in according to user preference" do
|
|
||||||
image = image_from a_photo_sent_by(bob)
|
image = image_from a_photo_sent_by(bob)
|
||||||
|
|
||||||
expect(image.exif.length).to eq(0)
|
expect(image.exif.length).to eq(0)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ describe Export::UserSerializer do
|
||||||
show_community_spotlight_in_stream: user.show_community_spotlight_in_stream,
|
show_community_spotlight_in_stream: user.show_community_spotlight_in_stream,
|
||||||
auto_follow_back: user.auto_follow_back,
|
auto_follow_back: user.auto_follow_back,
|
||||||
auto_follow_back_aspect: user.auto_follow_back_aspect,
|
auto_follow_back_aspect: user.auto_follow_back_aspect,
|
||||||
strip_exif: user.strip_exif,
|
|
||||||
blocks: user.blocks
|
blocks: user.blocks
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ RSpec::Matchers.define :be_a_clear_account do
|
||||||
].map {|attribute| user[attribute] }
|
].map {|attribute| user[attribute] }
|
||||||
|
|
||||||
user.disable_mail &&
|
user.disable_mail &&
|
||||||
user.strip_exif &&
|
|
||||||
!user.getting_started &&
|
!user.getting_started &&
|
||||||
!user.show_community_spotlight_in_stream &&
|
!user.show_community_spotlight_in_stream &&
|
||||||
!user.post_default_public &&
|
!user.post_default_public &&
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
def create_basic_users
|
def create_basic_users
|
||||||
# Users
|
# Users
|
||||||
alice = FactoryBot.create(:user_with_aspect, username: "alice", strip_exif: false)
|
alice = FactoryBot.create(:user_with_aspect, username: "alice")
|
||||||
alices_aspect = alice.aspects.where(name: "generic").first
|
alices_aspect = alice.aspects.where(name: "generic").first
|
||||||
|
|
||||||
eve = FactoryBot.create(:user_with_aspect, username: "eve")
|
eve = FactoryBot.create(:user_with_aspect, username: "eve")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue