Always strip exif data and drop user setting for it

Some imagemagick-versions (I tested Ubuntu 22.04 and debian bullseye)
always loose exif data when converting from jpg to webp. So this made
our CI fail now, but even if it wasn't failing before, some pods always
had and have versions which might loose the information anyway. So
having a setting to keep exif information is kinda pointless, if we
can't guarantee that the information isn't lost. Also, diaspora isn't a
photo sharing platform and we don't display exif information anywhere,
so I think we should just always strip exif data (which was already the
default before), as we don't need them.
This commit is contained in:
Benjamin Neff 2023-06-04 04:16:48 +02:00
parent 2fe5a7bd40
commit 763dffa328
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
16 changed files with 13 additions and 57 deletions

View file

@ -31,18 +31,6 @@ class UsersController < ApplicationController
render :edit
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
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
current_user.close_account!

View file

@ -76,8 +76,6 @@ class Photo < ApplicationRecord
photo = new(params.to_hash.stringify_keys.slice(*column_names, "author"))
photo.random_string = SecureRandom.hex(10)
photo.unprocessed_image.strip_exif = photo.author.owner.strip_exif
if params[:user_file]
image_file = params.delete(:user_file)
photo.unprocessed_image.store! image_file

View file

@ -569,7 +569,6 @@ class User < ApplicationRecord
self.remove_export = true
self.remove_exported_photos_file = true
self[:disable_mail] = true
self[:strip_exif] = true
self[:email] = "deletedaccount_#{self[:id]}@example.org"
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
serialized_private_key getting_started
disable_mail show_community_spotlight_in_stream
strip_exif email remove_after export exporting
email remove_after export exporting
exported_photos_file exporting_photos)
end
end

View file

@ -10,7 +10,6 @@ module Export
:show_community_spotlight_in_stream,
:auto_follow_back,
:auto_follow_back_aspect,
:strip_exif,
:blocks
has_one :profile, serializer: FederationEntitySerializer
has_many :contact_groups, each_serializer: Export::AspectSerializer

View file

@ -7,12 +7,6 @@
class UnprocessedImage < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
attr_accessor :strip_exif
def strip_exif
@strip_exif || false
end
def store_dir
"uploads/images"
end
@ -40,7 +34,7 @@ class UnprocessedImage < CarrierWave::Uploader::Base
manipulate! do |img|
img.combine_options do |i|
i.auto_orient
i.strip if strip_exif
i.strip
end
img = yield(img) if block_given?

View file

@ -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
.col-md-12
%h3

View file

@ -1331,7 +1331,6 @@ en:
privacy_settings:
title: "Privacy settings"
strip_exif: "Strip metadata such as location, author, and camera model from uploaded images (recommended)"
ignored_users: "Ignored users"
stop_ignoring: "Stop ignoring"
no_user_ignored_message: "You are not currently ignoring any other user"

View file

@ -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

View file

@ -123,7 +123,7 @@ class ArchiveImporter
end
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|
user.update(key => value) unless value.nil?
end

View file

@ -19,7 +19,6 @@
"null"
]
},
"strip_exif": { "type": "boolean" },
"blocks": {
"type": "array",
"items" : {

View file

@ -24,7 +24,7 @@ describe Diaspora::Exporter do
user_properties = build_property_hash(
user,
%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
)

View file

@ -116,7 +116,6 @@ describe ArchiveImporter do
"contact_groups" => [{
"name" => "Follow"
}],
"strip_exif" => false,
"show_community_spotlight_in_stream" => false,
"language" => "ru",
"auto_follow_back" => true,
@ -130,7 +129,6 @@ describe ArchiveImporter do
archive_importer.import
}.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.language).to eq("ru")
expect(archive_importer.user.auto_follow_back).to eq(true)
@ -142,7 +140,6 @@ describe ArchiveImporter do
archive_importer.import(import_settings: false)
}.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.language).to eq("en")
expect(archive_importer.user.auto_follow_back).to eq(false)

View file

@ -147,13 +147,7 @@ describe Photo, :type => :model do
FileUtils.rm_r Dir.glob(File.join(public_path, "uploads/images/*"))
end
it "should preserve EXIF data in according to user preference" 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
it "should strip EXIF data" do
image = image_from a_photo_sent_by(bob)
expect(image.exif.length).to eq(0)

View file

@ -14,7 +14,6 @@ describe Export::UserSerializer do
show_community_spotlight_in_stream: user.show_community_spotlight_in_stream,
auto_follow_back: user.auto_follow_back,
auto_follow_back_aspect: user.auto_follow_back_aspect,
strip_exif: user.strip_exif,
blocks: user.blocks
)
end

View file

@ -34,7 +34,6 @@ RSpec::Matchers.define :be_a_clear_account do
].map {|attribute| user[attribute] }
user.disable_mail &&
user.strip_exif &&
!user.getting_started &&
!user.show_community_spotlight_in_stream &&
!user.post_default_public &&

View file

@ -2,7 +2,7 @@
def create_basic_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
eve = FactoryBot.create(:user_with_aspect, username: "eve")