24 Commits

Author SHA1 Message Date
Oliver Günther 05bff78a1a Avoid using narrow_type for detecting content type of attachments 2026-01-08 13:22:40 +01:00
Jan Sandbrink 0b87e7543f Freeze string literals in specs
Rolling out frozen string literals further by freezing all
string literals in core specs.
2025-05-05 09:29:55 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Oliver Günther 2508ede65c Fix prepared upload specs 2024-02-20 09:37:03 +01:00
Christophe Bliard c795874f7f Update copyright year for 2024
command used: `rg -l 'Copyright \(C\) 2012-202\d the OpenProject' | xargs -n 100 sed -i -r 's/Copyright \(C\) 2012-202. the OpenProject/Copyright (C) 2012-2024 the OpenProject/'`
2024-01-02 16:23:54 +01:00
Klaus Zanders 78c1e4fadb Switch all uses of principal factories to use new interface 2023-10-09 10:39:44 +02:00
Klaus Zanders 8380e0dcd4 Refactor add_jorunal method to use keyword arguments 2023-07-03 10:03:39 +02:00
Christophe Bliard 4c2a9d0aa8 Enable RSpec zero monkey patching mode
The plan for RSpec 4.0 is to disable monkey patching.

See https://github.com/rspec/rspec-core/blob/main/features/configuration/zero_monkey_patching_mode.feature for details.
2023-05-31 19:22:29 +02:00
Christophe Bliard aa23106c11 lint: autocorrect RSpec/FactoryBot/ConsistentParenthesesStyle
command is

    rubocop -A --only RSpec/FactoryBot/ConsistentParenthesesStyle modules spec
2023-03-07 15:04:32 +01:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +02:00
Christophe Bliard a33524ef6d remove ruby magic comment for utf-8
ruby interprets source encoding as utf-8 since 2.0.0, making magic comment redundant and useless
2022-03-10 19:36:58 +01:00
Christophe Bliard 47a297daae Fix argument alignment since f08bea3467 (#10129)
* Fix argument alignment since f08bea3467

The FactoryBot.* prefix has been removed in f08bea3467. Since then
rubocop complains about Layout/ArgumentAlignment. This commit fixes it.

* do not fix alignments for modules/*/spec yet

hoping to be under the limit of 65535 characters for reviewdog to report on rubocop errors
2022-02-02 21:48:06 +01:00
Oliver Günther f08bea3467 Remove FactoryBot.* prefix where applicable 2022-01-25 08:19:06 +01:00
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
Oliver Günther e9d7c374cc [37868] Whitelist for attachment mime types and extensions on upload (#9431)
* Add setting for whitelist

* Make attachments API BaseServices compatible

* Add prepare service and contract

* Correctly pass the filename to the UploadedFile

* Add presence check to filename

* Fix expected validation message

* We no longer raise a multipart error when metadata is empty

* Fix filesize validation on prepared uploads

* Add parser error if invalid metadata json

* When attachment is not saved, use filename property

* Return correct error message on JSON parser erroro

* Fix specs

* Use attachment upload representer

* Fix direct uploads mocks with new service layer

* Lint

* Fix export job using attachment service

* Fix IFC controller using attachment prepare service

* Fix export job

* RenameRename params_getter to params_source

* Fix mail handler using attachment service

* Fix usage of attachment create service in documents

* Reuse shared examples for document attachment spec

* Fix stubbed attachment service in export job spec

* Use admin user in backup spec

* Fix export job for bim

* Fix attachment integration spec

* Fix issues_controller spec

* Make budget resource spec reuse common examples

* Fix attachment parsing representer spec

* Replace prepare part of attachment spec into separate service spec

* Clear cache for login spec

* Convert document create/update into services

* Budget services

* Allow options to be passed to property twin

* Remove setting author on budget initialize

* Replace meetings update with services

* Replace ifc models attachment handling with services

* Don't check uploader if changed by system

* Fix uploader being changed by system

* Replace wiki page attach_files with attachable services

* Replace avatar  saving

* Replace snapshot attach_files

* Skip double validation when container present

* Set snapshot through attachment service

* Remove attach_files

* Validate content type in contract

* Enforce writing the content type without accepting user input

* Expect changed content_type

* Fix content of viewpoint image to get correct content type

* Fix tsv spec

* Add create contract spec

* Bypass whitelist in internal services when conflicting with user

* Fix expects in specs after whitelist bypass

* Render contract errors for wiki

* Add before_hook to bodied to allow to pre-authorize permissions

* Budget errors from contract

* Document errors from contract
2021-07-14 14:43:19 +02:00
ulferts 2a015eeac3 Feature/journal aggregation on write (#9396)
* aggregate journals on write - simple implementation

* remove references to aggregated journals on read

* rewrite existing journals to be aggregated

* remove aggregated journal reference

* only delete predecessor if it can be aggregated

* fix aggregation condition

* adapt specs

* remove aggregated journal functionality from production code

The code is still necessary in a migration for the time being

* adapt specs

* use polymorphic belongs_to for journal data

The association can then be employed for eager loading

* eager load for activity rendering
2021-06-17 20:08:58 +02:00
ulferts 08ce0a5436 Fix/attachment journalizing (#9292)
* update the container timestamp upon attachment creation

That way, the journal subsequently created on the journalized container will bear the expected timestamp

* update container timestamp on attachment deletion

Without it, the journal created after the deletion will bear the wrong timestamp

* avoid bumping lock_version on attachment adding/destroy
2021-05-20 09:23:47 +02:00
ulferts 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +01:00
ulferts a895767619 have a delete service for attachments 2020-03-02 15:49:31 +01:00
ulferts 056b6f45af attachment create service more in line with general layout 2020-03-02 15:49:30 +01:00