decidim-core 0.25.0.rc2 → 0.25.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of decidim-core might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f79ffb8df1322e287abbc21fa43fae864cd76b7505c56ef58fcca6832e24d65
4
- data.tar.gz: ac09f979e6e0594e05e591b4d8ca6524301d9ee445fdebb0e76be572f04e6a32
3
+ metadata.gz: 7501cdb061920f3c951740c5df3c6d6b06df3b3ae6e39e08885dd02eb3b7071e
4
+ data.tar.gz: b9f623717650dc6c2430e98f3950c158f67390683dcd9f1fd9f7a59910916813
5
5
  SHA512:
6
- metadata.gz: 4afd6c6ecfadff2d1237451bd8e112053f20f55ac42e3035a7557d8d4a667060ffb82d098c6134ffacc0b4736ab40896ab03b596664188510bff859b878b07db
7
- data.tar.gz: c3d2ff88bdcef9ebe353035eba87992f236dd45496c68f274bbf945dddf3197e760bb5d249facd71b5003865a729b27f0c7d87f1d345ca6cfea9f6ff98bb8480
6
+ metadata.gz: 4c737ee3bddfcbe9308288720e1202d1dc608bdcc01ca2ebb9bdc759c8e6e0cc2f9850c25854d4b4bae0acf24a593c18eeaed6e19296e73e43c7912b08b15a0b
7
+ data.tar.gz: aedb81b1e86057d32427cc362e74b271f5215c2d4aa44a31fd6befd18d4c33977b6175277701a1d60f51cc3e7f0e7b67eb9ad4bd18913c66f984dc49b29d611b
@@ -143,9 +143,10 @@ shared_examples "comments" do
143
143
  end
144
144
  end
145
145
 
146
- it "shows comment to the user and updates the comments counter" do
146
+ it "shows comment to the user, updates the comments counter and clears the comment textarea" do
147
147
  expect(page).to have_comment_from(user, "This is a new comment", wait: 20)
148
148
  expect(page).to have_selector("span.comments-count", text: "#{commentable.comments.count} COMMENTS")
149
+ expect(page).to have_field("add-comment-#{commentable.commentable_type.demodulize}-#{commentable.id}", with: "")
149
150
  end
150
151
  end
151
152
 
@@ -166,6 +167,55 @@ shared_examples "comments" do
166
167
  end
167
168
  end
168
169
 
170
+ context "when the user is writing a new comment while someone else comments" do
171
+ let(:new_comment_body) { "Hey, I just jumped in the conversation!" }
172
+ let(:new_comment) { build(:comment, commentable: commentable, body: new_comment_body) }
173
+
174
+ before do
175
+ within ".add-comment form" do
176
+ fill_in "add-comment-#{commentable.commentable_type.demodulize}-#{commentable.id}", with: "This is a new comment"
177
+ end
178
+ new_comment.save!
179
+ end
180
+
181
+ it "does not clear the current user's comment" do
182
+ expect(page).to have_content(new_comment.body.values.first, wait: 20)
183
+ expect(page).to have_field(
184
+ "add-comment-#{commentable.commentable_type.demodulize}-#{commentable.id}",
185
+ with: "This is a new comment"
186
+ )
187
+ end
188
+
189
+ context "when inside a thread reply form" do
190
+ let(:thread) { comments.first }
191
+ let(:new_reply_body) { "Hey, I just jumped inside the thread!" }
192
+ let(:new_reply) { build(:comment, commentable: thread, root_commentable: commentable, body: new_reply_body) }
193
+
194
+ before do
195
+ within "#comment_#{thread.id}" do
196
+ click_button "Reply"
197
+
198
+ within ".add-comment form" do
199
+ fill_in "add-comment-#{thread.commentable_type.demodulize}-#{thread.id}", with: "This is a new reply"
200
+ end
201
+ end
202
+ new_reply.save!
203
+ end
204
+
205
+ it "does not clear the current user's comment" do
206
+ expect(page).to have_content(new_reply.body.values.first, wait: 20)
207
+ expect(page).to have_field(
208
+ "add-comment-#{commentable.commentable_type.demodulize}-#{commentable.id}",
209
+ with: "This is a new comment"
210
+ )
211
+ expect(page).to have_field(
212
+ "add-comment-#{thread.commentable_type.demodulize}-#{thread.id}",
213
+ with: "This is a new reply"
214
+ )
215
+ end
216
+ end
217
+ end
218
+
169
219
  context "when the user has verified organizations" do
170
220
  let(:user_group) { create(:user_group, :verified) }
171
221
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-core version.
5
5
  module Core
6
6
  def self.version
7
- "0.25.0.rc2"
7
+ "0.25.0.rc3"
8
8
  end
9
9
  end
10
10
  end
@@ -55,12 +55,8 @@ namespace :decidim do
55
55
  end
56
56
 
57
57
  def install_decidim_npm
58
- decidim_npm_packages.each do |type, package|
59
- if type == :dev
60
- system! "npm i -D #{package}"
61
- else
62
- system! "npm i #{package}"
63
- end
58
+ decidim_npm_packages.each do |type, packages|
59
+ system! "npm i --save-#{type} #{packages.join(" ")}"
64
60
  end
65
61
  end
66
62
 
@@ -73,32 +69,55 @@ namespace :decidim do
73
69
  end
74
70
 
75
71
  def decidim_npm_packages
72
+ gem_path = unreleased_gem_path
73
+
74
+ if gem_path
75
+ package_spec = "./packages/%s"
76
+
77
+ # The packages folder needs to be copied to the application folder
78
+ # because the linked dependencies are not installed when packages
79
+ # are installed using file references outside the application root
80
+ # where the `package.json` is located at. For more information, see:
81
+ # https://github.com/npm/cli/issues/2339
82
+ FileUtils.rm_rf(rails_app_path.join("packages"))
83
+ FileUtils.cp_r(gem_path.join("packages"), rails_app_path)
84
+ else
85
+ package_spec = "@decidim/%s@~#{Decidim::GemManager.semver_friendly_version(decidim_gemspec.version.to_s)}"
86
+ end
87
+
88
+ local_npm_dependencies.transform_values { |names| names.map { |name| format(package_spec, name) } }
89
+ end
90
+
91
+ def unreleased_gem_path
76
92
  if decidim_gemspec.source.is_a?(Bundler::Source::Rubygems)
77
- if released_version?
78
- return {
79
- dev: "@decidim/dev@~#{Decidim::GemManager.semver_friendly_version(decidim_gemspec.version.to_s)}",
80
- prod: "@decidim/all@~#{Decidim::GemManager.semver_friendly_version(decidim_gemspec.version.to_s)}"
81
- }
82
- else
83
- gem_path = Pathname(decidim_gemspec.full_gem_path)
84
- end
93
+ return if released_version?
94
+
95
+ gem_path = Pathname(decidim_gemspec.full_gem_path)
85
96
  else
86
97
  gem_path = decidim_gemspec.source.path
87
98
  gem_path = Pathname(ENV["BUNDLE_GEMFILE"]).dirname.join(gem_path) if gem_path.relative?
88
99
  end
89
100
 
90
- # The packages folder needs to be copied to the application folder
91
- # because the linked dependencies are not installed when packages
92
- # are installed using file references outside the application root
93
- # where the `package.json` is located at. For more information, see:
94
- # https://github.com/npm/cli/issues/2339
95
- FileUtils.rm_rf(rails_app_path.join("packages"))
96
- FileUtils.cp_r(gem_path.join("packages"), rails_app_path)
101
+ gem_path
102
+ end
103
+
104
+ def local_npm_dependencies
105
+ @local_npm_dependencies ||= begin
106
+ package_json = JSON.parse(File.read(decidim_path.join("package.json")))
107
+
108
+ {
109
+ prod: local_npm_dependencies_list(package_json["dependencies"]),
110
+ dev: local_npm_dependencies_list(package_json["devDependencies"])
111
+ }.freeze
112
+ end
113
+ end
114
+
115
+ def local_npm_dependencies_list(deps)
116
+ return [] unless deps
97
117
 
98
- {
99
- dev: "./packages/dev",
100
- prod: "./packages/all"
101
- }
118
+ deps.values
119
+ .select { |ref| ref.starts_with?("file:packages/") }
120
+ .map { |ref| ref.delete_prefix("file:packages/") }
102
121
  end
103
122
 
104
123
  def decidim_path
@@ -151,8 +170,8 @@ namespace :decidim do
151
170
  File.write(file, contents)
152
171
  end
153
172
 
154
- def system!(*args)
155
- system(*args) || abort("\n== Command #{args} failed ==")
173
+ def system!(command)
174
+ system("cd #{rails_app_path} && #{command}") || abort("\n== Command #{command} failed ==")
156
175
  end
157
176
  end
158
177
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0.rc2
4
+ version: 0.25.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-09-13 00:00:00.000000000 Z
13
+ date: 2021-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -790,28 +790,28 @@ dependencies:
790
790
  requirements:
791
791
  - - '='
792
792
  - !ruby/object:Gem::Version
793
- version: 0.25.0.rc2
793
+ version: 0.25.0.rc3
794
794
  type: :runtime
795
795
  prerelease: false
796
796
  version_requirements: !ruby/object:Gem::Requirement
797
797
  requirements:
798
798
  - - '='
799
799
  - !ruby/object:Gem::Version
800
- version: 0.25.0.rc2
800
+ version: 0.25.0.rc3
801
801
  - !ruby/object:Gem::Dependency
802
802
  name: decidim-dev
803
803
  requirement: !ruby/object:Gem::Requirement
804
804
  requirements:
805
805
  - - '='
806
806
  - !ruby/object:Gem::Version
807
- version: 0.25.0.rc2
807
+ version: 0.25.0.rc3
808
808
  type: :development
809
809
  prerelease: false
810
810
  version_requirements: !ruby/object:Gem::Requirement
811
811
  requirements:
812
812
  - - '='
813
813
  - !ruby/object:Gem::Version
814
- version: 0.25.0.rc2
814
+ version: 0.25.0.rc3
815
815
  description: Adds core features so other engines can hook into the framework.
816
816
  email:
817
817
  - josepjaume@gmail.com