govuk_content_models 27.1.0 → 27.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 27.2.0
2
+
3
+ - Adds `unassign` instance method for `User` class which allows users to
4
+ unassign an `Edition`.
5
+
1
6
  ## 27.1.0
2
7
 
3
8
  Updates the LinkValidator to validate smart quotes in the same way as normal quotes
data/app/models/user.rb CHANGED
@@ -78,4 +78,8 @@ class User
78
78
  def assign(edition, recipient)
79
79
  GovukContentModels::ActionProcessors::AssignProcessor.new(self, edition, { recipient_id: recipient.id }).processed_edition
80
80
  end
81
+
82
+ def unassign(edition)
83
+ GovukContentModels::ActionProcessors::AssignProcessor.new(self, edition).processed_edition
84
+ end
81
85
  end
@@ -116,7 +116,8 @@ module Workflow
116
116
  end
117
117
 
118
118
  def denormalise_users!
119
- set(:assignee, assigned_to.name) if assigned_to
119
+ new_assignee = assigned_to.try(:name)
120
+ set(:assignee, new_assignee) unless new_assignee == assignee
120
121
  update_user_action("creator", [Action::CREATE, Action::NEW_VERSION])
121
122
  update_user_action("publisher", [Action::PUBLISH])
122
123
  update_user_action("archiver", [Action::ARCHIVE])
@@ -1,4 +1,4 @@
1
1
  module GovukContentModels
2
2
  # Changing this causes Jenkins to tag and release the gem into the wild
3
- VERSION = "27.1.0"
3
+ VERSION = "27.2.0"
4
4
  end
@@ -123,6 +123,25 @@ class UserTest < ActiveSupport::TestCase
123
123
  assert_equal(worker_user, publication.assigned_to)
124
124
  end
125
125
 
126
+ test "Edition can be unassigned" do
127
+ boss_user = FactoryGirl.create(:user, :name => "Mat")
128
+ worker_user = FactoryGirl.create(:user, :name => "Grunt")
129
+
130
+ publication = boss_user.create_edition(:answer, title: "test answer", slug: "test", panopticon_id: @artefact.id)
131
+ boss_user.assign(publication, worker_user)
132
+ publication.save
133
+ publication.reload
134
+
135
+ assert_equal(worker_user, publication.assigned_to)
136
+
137
+ boss_user.unassign(publication)
138
+ publication.save
139
+ publication.reload
140
+
141
+ assert_nil publication.assigned_to
142
+ end
143
+
144
+
126
145
  test "should default to a collection called 'users'" do
127
146
  assert_equal "users", User.collection_name
128
147
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_content_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 27.1.0
4
+ version: 27.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2014-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
16
- requirement: &19617640 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19617640
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: gds-api-adapters
27
- requirement: &19615920 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 10.9.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *19615920
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 10.9.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: gds-sso
38
- requirement: &19611040 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 10.0.0
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *19611040
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 10.0.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: govspeak
49
- requirement: &19405300 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 3.1.0
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *19405300
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 3.1.0
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: mongoid
60
- requirement: &19422380 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '2.5'
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *19422380
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '2.5'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: plek
71
- requirement: &19419000 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *19419000
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: state_machine
82
- requirement: &19417740 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,54 +117,79 @@ dependencies:
87
117
  version: '0'
88
118
  type: :runtime
89
119
  prerelease: false
90
- version_requirements: *19417740
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: database_cleaner
93
- requirement: &19415780 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
- - - =
131
+ - - '='
97
132
  - !ruby/object:Gem::Version
98
133
  version: 0.7.2
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *19415780
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - '='
140
+ - !ruby/object:Gem::Version
141
+ version: 0.7.2
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: factory_girl
104
- requirement: &19415040 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
- - - =
147
+ - - '='
108
148
  - !ruby/object:Gem::Version
109
149
  version: 3.3.0
110
150
  type: :development
111
151
  prerelease: false
112
- version_requirements: *19415040
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - '='
156
+ - !ruby/object:Gem::Version
157
+ version: 3.3.0
113
158
  - !ruby/object:Gem::Dependency
114
159
  name: gem_publisher
115
- requirement: &19518200 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
116
161
  none: false
117
162
  requirements:
118
- - - =
163
+ - - '='
119
164
  - !ruby/object:Gem::Version
120
165
  version: 1.2.0
121
166
  type: :development
122
167
  prerelease: false
123
- version_requirements: *19518200
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 1.2.0
124
174
  - !ruby/object:Gem::Dependency
125
175
  name: mocha
126
- requirement: &19515540 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
127
177
  none: false
128
178
  requirements:
129
- - - =
179
+ - - '='
130
180
  - !ruby/object:Gem::Version
131
181
  version: 0.13.3
132
182
  type: :development
133
183
  prerelease: false
134
- version_requirements: *19515540
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - '='
188
+ - !ruby/object:Gem::Version
189
+ version: 0.13.3
135
190
  - !ruby/object:Gem::Dependency
136
191
  name: multi_json
137
- requirement: &19528860 !ruby/object:Gem::Requirement
192
+ requirement: !ruby/object:Gem::Requirement
138
193
  none: false
139
194
  requirements:
140
195
  - - ! '>='
@@ -142,54 +197,79 @@ dependencies:
142
197
  version: '0'
143
198
  type: :development
144
199
  prerelease: false
145
- version_requirements: *19528860
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
146
206
  - !ruby/object:Gem::Dependency
147
207
  name: rake
148
- requirement: &20219280 !ruby/object:Gem::Requirement
208
+ requirement: !ruby/object:Gem::Requirement
149
209
  none: false
150
210
  requirements:
151
- - - =
211
+ - - '='
152
212
  - !ruby/object:Gem::Version
153
213
  version: 0.9.2.2
154
214
  type: :development
155
215
  prerelease: false
156
- version_requirements: *20219280
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - '='
220
+ - !ruby/object:Gem::Version
221
+ version: 0.9.2.2
157
222
  - !ruby/object:Gem::Dependency
158
223
  name: webmock
159
- requirement: &20217960 !ruby/object:Gem::Requirement
224
+ requirement: !ruby/object:Gem::Requirement
160
225
  none: false
161
226
  requirements:
162
- - - =
227
+ - - '='
163
228
  - !ruby/object:Gem::Version
164
229
  version: 1.8.7
165
230
  type: :development
166
231
  prerelease: false
167
- version_requirements: *20217960
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - '='
236
+ - !ruby/object:Gem::Version
237
+ version: 1.8.7
168
238
  - !ruby/object:Gem::Dependency
169
239
  name: shoulda-context
170
- requirement: &20216640 !ruby/object:Gem::Requirement
240
+ requirement: !ruby/object:Gem::Requirement
171
241
  none: false
172
242
  requirements:
173
- - - =
243
+ - - '='
174
244
  - !ruby/object:Gem::Version
175
245
  version: 1.0.0
176
246
  type: :development
177
247
  prerelease: false
178
- version_requirements: *20216640
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - '='
252
+ - !ruby/object:Gem::Version
253
+ version: 1.0.0
179
254
  - !ruby/object:Gem::Dependency
180
255
  name: timecop
181
- requirement: &20215040 !ruby/object:Gem::Requirement
256
+ requirement: !ruby/object:Gem::Requirement
182
257
  none: false
183
258
  requirements:
184
- - - =
259
+ - - '='
185
260
  - !ruby/object:Gem::Version
186
261
  version: 0.5.9.2
187
262
  type: :development
188
263
  prerelease: false
189
- version_requirements: *20215040
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ none: false
266
+ requirements:
267
+ - - '='
268
+ - !ruby/object:Gem::Version
269
+ version: 0.5.9.2
190
270
  - !ruby/object:Gem::Dependency
191
271
  name: debugger
192
- requirement: &20212320 !ruby/object:Gem::Requirement
272
+ requirement: !ruby/object:Gem::Requirement
193
273
  none: false
194
274
  requirements:
195
275
  - - ! '>='
@@ -197,10 +277,15 @@ dependencies:
197
277
  version: '0'
198
278
  type: :development
199
279
  prerelease: false
200
- version_requirements: *20212320
280
+ version_requirements: !ruby/object:Gem::Requirement
281
+ none: false
282
+ requirements:
283
+ - - ! '>='
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
201
286
  - !ruby/object:Gem::Dependency
202
287
  name: rack
203
- requirement: &20225460 !ruby/object:Gem::Requirement
288
+ requirement: !ruby/object:Gem::Requirement
204
289
  none: false
205
290
  requirements:
206
291
  - - ~>
@@ -208,18 +293,28 @@ dependencies:
208
293
  version: 1.4.4
209
294
  type: :development
210
295
  prerelease: false
211
- version_requirements: *20225460
296
+ version_requirements: !ruby/object:Gem::Requirement
297
+ none: false
298
+ requirements:
299
+ - - ~>
300
+ - !ruby/object:Gem::Version
301
+ version: 1.4.4
212
302
  - !ruby/object:Gem::Dependency
213
303
  name: rails
214
- requirement: &20222080 !ruby/object:Gem::Requirement
304
+ requirement: !ruby/object:Gem::Requirement
215
305
  none: false
216
306
  requirements:
217
- - - =
307
+ - - '='
218
308
  - !ruby/object:Gem::Version
219
309
  version: 3.2.17
220
310
  type: :development
221
311
  prerelease: false
222
- version_requirements: *20222080
312
+ version_requirements: !ruby/object:Gem::Requirement
313
+ none: false
314
+ requirements:
315
+ - - '='
316
+ - !ruby/object:Gem::Version
317
+ version: 3.2.17
223
318
  description: Shared models for Panopticon and Publisher
224
319
  email:
225
320
  - pbattley@gmail.com
@@ -380,7 +475,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
380
475
  version: '0'
381
476
  segments:
382
477
  - 0
383
- hash: -2893959109595169673
478
+ hash: 4146822323312464372
384
479
  required_rubygems_version: !ruby/object:Gem::Requirement
385
480
  none: false
386
481
  requirements:
@@ -389,10 +484,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
389
484
  version: '0'
390
485
  segments:
391
486
  - 0
392
- hash: -2893959109595169673
487
+ hash: 4146822323312464372
393
488
  requirements: []
394
489
  rubyforge_project:
395
- rubygems_version: 1.8.11
490
+ rubygems_version: 1.8.23
396
491
  signing_key:
397
492
  specification_version: 3
398
493
  summary: Shared models for Panopticon and Publisher, as a Rails Engine