mumuki-domain 7.12.2 → 8.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c03b11014fe958aaa9ab0e980a40f5f68b3adafd4ccc593bc0fcf04771a68f5b
4
- data.tar.gz: d2ac0f573097e57a62e4e13f2d2dc4116ecb8ab5dfca033fd5ac69d0c9afd33a
3
+ metadata.gz: 2e3057a4511ba66a280fe3f5bf53052a33161ecd9a45dfb6851d2dc21ea7ad20
4
+ data.tar.gz: bb89fde6326417de9590369040b1d61a13ec35ea1abe8d365c0d21aa66777315
5
5
  SHA512:
6
- metadata.gz: 998b1c0f0ee18cc59a8173c1d2ebbbeb930e877bddf1fdcb6e3dc3edc31509f63e16f0db48cb506ba35e4e35ac363f9ee625c58f6cd0da95d82461f6dd586102
7
- data.tar.gz: da140f00d91f6408e176453bf36b33108c9e73552e8c7ce3666f31d11145cf87bdcd5afc40e3edb8fac066073bb4ff49e0db4e435cfb862f295b2e05836a16ad
6
+ metadata.gz: 586446caac1b0eeecf18d5754e1fb1120e1d0f5a87a4d386152f64af9d6f0b5f18b089676cc994c7f717baa3382b120d7ea71e011263e8761ad5b830dbfefb02
7
+ data.tar.gz: 77d0ddcfaea1ffaae2d22e5cb7e9b30e08b3d6ef4d303fad9df0062294353dab7834f35fd8fdf339fa770cc233c293f6bf6173442262f11e98eef2521bf3d952
@@ -70,9 +70,8 @@ class ApplicationRecord < ActiveRecord::Base
70
70
  end
71
71
 
72
72
  def update_and_notify!(data)
73
- update! data
74
- notify!
75
- self
73
+ assign_attributes data
74
+ save_and_notify!
76
75
  end
77
76
 
78
77
  def self.aggregate_of(association)
@@ -105,7 +104,7 @@ class ApplicationRecord < ActiveRecord::Base
105
104
  obj
106
105
  end
107
106
 
108
- def self.whitelist_attributes(a_hash, options={})
107
+ def self.whitelist_attributes(a_hash, options = {})
109
108
  attributes = attribute_names
110
109
  attributes += reflections.keys if options[:relations]
111
110
  a_hash.with_indifferent_access.slice(*attributes).except(*options[:except])
@@ -5,7 +5,7 @@ class Exam < ApplicationRecord
5
5
  include TerminalNavigation
6
6
 
7
7
  belongs_to :organization
8
- belongs_to :course, optional: true
8
+ belongs_to :course
9
9
 
10
10
  has_many :authorizations, class_name: 'ExamAuthorization', dependent: :destroy
11
11
  has_many :users, through: :authorizations
@@ -186,8 +186,6 @@ class Exam < ApplicationRecord
186
186
  exam[:start_time] = exam[:start_time].to_time
187
187
  exam[:end_time] = exam[:end_time].to_time
188
188
  exam[:classroom_id] = exam[:eid] if exam[:eid].present?
189
- exam[:passing_criterion_type] = exam.dig(:passing_criterion, :type)
190
- exam[:passing_criterion_value] = exam.dig(:passing_criterion, :value)
191
189
  end
192
190
 
193
191
  def self.remove_previous_version(eid, guide_id)
@@ -139,9 +139,9 @@ class User < ApplicationRecord
139
139
 
140
140
  def interpolations
141
141
  {
142
- 'user_email' => email,
143
- 'user_first_name' => first_name,
144
- 'user_last_name' => last_name
142
+ 'user_email' => email,
143
+ 'user_first_name' => first_name,
144
+ 'user_last_name' => last_name
145
145
  }
146
146
  end
147
147
 
@@ -251,6 +251,21 @@ class User < ApplicationRecord
251
251
  end
252
252
  end
253
253
 
254
+ def notify_permissions_changed!
255
+ return if permissions_before_last_save == permissions
256
+ Mumukit::Nuntius.notify! 'user-permissions-changed', user: {
257
+ uid: uid,
258
+ old_permissions: permissions_before_last_save.as_json,
259
+ new_permissions: permissions.as_json
260
+ }
261
+ end
262
+
263
+ def save_and_notify!
264
+ save!
265
+ notify_permissions_changed!
266
+ self
267
+ end
268
+
254
269
  private
255
270
 
256
271
  def welcome_to_new_organizations!
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :term do
3
- content { Faker::Lorem.sentence(word_count: 2000) }
3
+ content { Faker::Lorem.sentence(word_count: 100) }
4
4
  header { Faker::Lorem.sentence(word_count: 5) }
5
5
  end
6
6
  end
@@ -41,7 +41,7 @@ module Mumuki::Domain::Helpers::Organization
41
41
  end
42
42
 
43
43
  def url_for(path)
44
- Mumukit::Platform.application.organic_url_for(name, path)
44
+ Mumukit::Platform.laboratory.organic_url_for(name, path)
45
45
  end
46
46
 
47
47
  def url
@@ -8,6 +8,7 @@ module Mumuki::Domain::Helpers::User
8
8
  delegate :has_role?,
9
9
  :add_permission!,
10
10
  :remove_permission!,
11
+ :update_permission!,
11
12
  :has_permission?,
12
13
  :has_permission_delegation?,
13
14
  :protect!,
@@ -36,6 +36,6 @@ class Mumuki::Domain::Organization::Profile < Mumukit::Platform::Model
36
36
  end
37
37
 
38
38
  def open_graph_image_url
39
- @open_graph_image_url ||= Mumukit::Platform.application.url_for("logo-alt.png") # Best image size: 256x256
39
+ @open_graph_image_url ||= Mumukit::Platform.laboratory.url_for("logo-alt.png") # Best image size: 256x256
40
40
  end
41
41
  end
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '7.12.2'
3
+ VERSION = '8.0.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.12.2
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-17 00:00:00.000000000 Z
11
+ date: 2020-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '5.2'
131
+ version: '6.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '5.2'
138
+ version: '6.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: mumukit-sync
141
141
  requirement: !ruby/object:Gem::Requirement