10000 Fix missing tags when splitting a model by Floppy · Pull Request #2868 · manyfold3d/manyfold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix missing tags when splitting a model #2868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def split!(files: [])
new_model = dup
new_model.name = "Copy of #{name}"
new_model.public_id = nil
new_model.tags = tags
new_model.organize!
# Move files
files.each do |file|
Expand Down
12 changes: 9 additions & 3 deletions spec/models/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@

context "when splitting" do
subject!(:model) {
m = create(:model)
m = create(:model, creator: create(:creator), collection: create(:collection), license: "CC-BY-4.0", caption: "test", notes: "note")
m.tag_list << "tag1"
m.tag_list << "tag2"
create(:model_file, model: m)
create(:model_file, model: m)
m
Expand All @@ -257,10 +259,14 @@
expect { model.split! }.to change(described_class, :count).by(1)
end

it "copies old model metadata" do # rubocop:todo RSpec/MultipleExpectations
it "prepends 'Copy of' to name" do
new_model = model.split!
expect(new_model.name).to eq "Copy of #{model.name}"
[:notes, :caption, :collection, :creator, :license].each do |field|
end

[:notes, :caption, :collection, :creator, :license, :tags].each do |field|
it "copies old model #{field}" do
new_model = model.split!
expect(new_model.send(field)).to eq model.send(field)
end
end
Expand Down
Loading
0