OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Revert "Transformed StorageFile class into a struct"
Andreas Pfohldf0e3607ea9e
diff --git a/modules/storages/app/models/storages/storage_file.rb b/modules/storages/app/models/storages/storage_file.rbindex 983c3c99a20..24e258d6deb 100644--- a/modules/storages/app/models/storages/storage_file.rb+++ b/modules/storages/app/models/storages/storage_file.rb@@ -1,51 +1,15 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2022 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#+++class Storages::StorageFile+ attr_reader :id, :name, :size, :mime_type, :created_at, :last_modified_at, :created_by_name, :last_modified_by_name, :location-module Storages- struct_name = 'StorageFile'-- # rubocop:disable Nameing/ConstantName- StorageFile =- if Struct::const_defined?(struct_name)- Struct.const_get(struct_name)- else- Struct.new(- struct_name,- :id,- :name,- :file_size,- :mime_type,- :created_at,- :last_modified_at,- :created_by_name,- :last_modified_by_name,- :location- )- end- # rubocop:enable Nameing/ConstantName+ def initialize(id, name, size, mime_type, created_at, last_modified_at, created_by_name, last_modified_by_name, location)+ @id = id+ @name = name+ @size = size+ @mime_type = mime_type+ @created_at = created_at+ @last_modified_at = last_modified_at+ @created_by_name = created_by_name+ @last_modified_by_name = last_modified_by_name+ @location = location+ endenddiff --git a/modules/storages/lib/api/v3/storage_files/storage_file_representer.rb b/modules/storages/lib/api/v3/storage_files/storage_file_representer.rbindex 47e21595584..dde6f36c54d 100644--- a/modules/storages/lib/api/v3/storage_files/storage_file_representer.rb+++ b/modules/storages/lib/api/v3/storage_files/storage_file_representer.rb@@ -32,7 +32,7 @@ module API::V3::StorageFilesproperty :idproperty :name- property :size, getter: ->(*) { file_size }+ property :sizeproperty :mime_typedate_time_property :created_atdate_time_property :last_modified_at@@ -41,7 +41,7 @@ module API::V3::StorageFilesproperty :locationdef _type- Storages::StorageFile.class.to_s+ 'StorageFile'endendend