mumuki-domain 9.9.0 → 9.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/concerns/organization/status/base.rb +22 -0
  3. data/app/models/concerns/organization/status/disabled.rb +28 -0
  4. data/app/models/concerns/organization/status/enabled.rb +26 -0
  5. data/app/models/concerns/organization/status/in_preparation.rb +27 -0
  6. data/app/models/concerns/with_assignments.rb +6 -0
  7. data/app/models/concerns/with_discussion_creation/subscription.rb +1 -1
  8. data/app/models/concerns/with_notifications.rb +1 -1
  9. data/app/models/concerns/with_organization_status.rb +32 -0
  10. data/app/models/concerns/with_progress.rb +4 -0
  11. data/app/models/concerns/with_reminders.rb +1 -1
  12. data/app/models/discussion.rb +9 -3
  13. data/app/models/exam_authorization_request.rb +1 -1
  14. data/app/models/exam_registration.rb +5 -1
  15. data/app/models/exam_registration/authorization_criterion.rb +7 -3
  16. data/app/models/message.rb +5 -0
  17. data/app/models/notification.rb +13 -1
  18. data/app/models/organization.rb +5 -0
  19. data/app/models/organization_access_mode.rb +2 -0
  20. data/app/models/organization_access_mode/base.rb +45 -0
  21. data/app/models/organization_access_mode/coming_soon.rb +5 -0
  22. data/app/models/organization_access_mode/forbidden.rb +22 -0
  23. data/app/models/organization_access_mode/full.rb +28 -0
  24. data/app/models/organization_access_mode/gone.rb +5 -0
  25. data/app/models/organization_access_mode/read_only.rb +33 -0
  26. data/app/models/user.rb +22 -4
  27. data/app/models/user_stats.rb +1 -1
  28. data/db/migrate/20210719145706_add_new_fields_to_notifications.rb +8 -0
  29. data/db/migrate/20210803175124_add_ignored_notifications_to_users.rb +5 -0
  30. data/lib/mumuki/domain/helpers/organization.rb +0 -5
  31. data/lib/mumuki/domain/incognito.rb +16 -0
  32. data/lib/mumuki/domain/organization/settings.rb +1 -1
  33. data/lib/mumuki/domain/version.rb +1 -1
  34. metadata +20 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bae661db3a1a6f210ac27b6d998846fde5a4968acdbcec182db4cca7d9dd4245
4
- data.tar.gz: 8ed2e95b7d1b21768062735e1fe8c5fbb55fe50e0c17821ae6e3baf8a9d50b5c
3
+ metadata.gz: cce9f2ab048f758a4122c66f8a3da650a28c3a2ef10aefd8887a89091ba7a2af
4
+ data.tar.gz: c55a063f04e3ae7d32750db8b7f520a2bd3f8d37f4411201011fec953ee99079
5
5
  SHA512:
6
- metadata.gz: b0f931e47808ff51e1cabe419e31a3d59ad9a3d3cf61f6ef66ff9b3e2026bc3db6441f5352002fad29d047ad23fa5030bede82b0d6a7b8e07b58875a236a1827
7
- data.tar.gz: 2da409d2e2c0e606457e6f78e72d97ec7ac8ba9ca0c20b12cffc3d48e9d4d72e131e7379ff2ceb60c1aa124f4ec5db30e653fca12812b0bb4ef4db3398d72d32
6
+ metadata.gz: d203713ba3bcb38b7d36971a77718ff3887e82d51199e9423635f62a5a244d75433f5aefb7fbfe9c0994971b178dafc655eae03a4b8c9d48bcd0ccc655785441
7
+ data.tar.gz: c3b3db4bc2faac6b2ec976aa380fdd5ad203ee248f6fc96a7dccee55c58a794d7c7f11944be3ef75f311bd5f791e87590c676192194c3c4247e4dc53a51f67cf
@@ -0,0 +1,22 @@
1
+ class Organization::Status::Base
2
+
3
+ attr_reader :organization
4
+
5
+ implements :teacher_access_mode, :student_access_mode, :ex_student_access_mode, :outsider_access_mode, :validate!
6
+
7
+ def initialize(organization)
8
+ @organization = organization
9
+ end
10
+
11
+ def access_mode(user)
12
+ if user&.teacher_of? organization
13
+ teacher_access_mode(user)
14
+ elsif user&.student_of? organization
15
+ student_access_mode(user)
16
+ elsif user&.ex_student_of? organization
17
+ ex_student_access_mode(user)
18
+ else
19
+ outsider_access_mode(user)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ class Organization::Status::Disabled < Organization::Status::Base
2
+
3
+ def teacher_access_mode(user)
4
+ OrganizationAccessMode::Full.new user, organization
5
+ end
6
+
7
+ def student_access_mode(user)
8
+ OrganizationAccessMode::ReadOnly.new user, organization, :faqs, :profile, :exercises, :discussions
9
+ end
10
+
11
+ def ex_student_access_mode(user)
12
+ OrganizationAccessMode::ReadOnly.new user, organization, :faqs, :profile
13
+ end
14
+
15
+ def outsider_access_mode(user)
16
+ if organization.public?
17
+ OrganizationAccessMode::Gone.new user, organization
18
+ else
19
+ OrganizationAccessMode::Forbidden.new user, organization
20
+ end
21
+ end
22
+
23
+ def validate!(user = nil)
24
+ raise Mumuki::Domain::DisabledOrganizationError unless user
25
+ end
26
+
27
+ end
28
+
@@ -0,0 +1,26 @@
1
+ class Organization::Status::Enabled < Organization::Status::Base
2
+
3
+ def teacher_access_mode(user)
4
+ OrganizationAccessMode::Full.new user, organization
5
+ end
6
+
7
+ def student_access_mode(user)
8
+ OrganizationAccessMode::Full.new user, organization
9
+ end
10
+
11
+ def ex_student_access_mode(user)
12
+ OrganizationAccessMode::ReadOnly.new user, organization, :faqs, :profile, :discussions, exercises: :submitted
13
+ end
14
+
15
+ def outsider_access_mode(user)
16
+ if organization.public?
17
+ OrganizationAccessMode::Full.new user, organization
18
+ else
19
+ OrganizationAccessMode::Forbidden.new user, organization
20
+ end
21
+ end
22
+
23
+ def validate!(_user = nil)
24
+ end
25
+
26
+ end
@@ -0,0 +1,27 @@
1
+ class Organization::Status::InPreparation < Organization::Status::Base
2
+
3
+ def teacher_access_mode(user)
4
+ OrganizationAccessMode::Full.new user, organization
5
+ end
6
+
7
+ def student_access_mode(user)
8
+ OrganizationAccessMode::ComingSoon.new user, organization
9
+ end
10
+
11
+ def ex_student_access_mode(user)
12
+ OrganizationAccessMode::Forbidden.new user, organization
13
+ end
14
+
15
+ def outsider_access_mode(user)
16
+ if organization.public?
17
+ OrganizationAccessMode::ComingSoon.new user, organization
18
+ else
19
+ OrganizationAccessMode::Forbidden.new user, organization
20
+ end
21
+ end
22
+
23
+ def validate!(user = nil)
24
+ raise Mumuki::Domain::UnpreparedOrganizationError unless user
25
+ end
26
+
27
+ end
@@ -30,4 +30,10 @@ module WithAssignments
30
30
  def assignment_for(user, organization=Organization.current)
31
31
  find_assignment_for(user, organization) || user.build_assignment(self, organization)
32
32
  end
33
+
34
+ def has_progress_for?(user, organization)
35
+ user.present? && find_assignment_for(user, organization).present?
36
+ end
37
+
38
+
33
39
  end
@@ -8,7 +8,7 @@ module WithDiscussionCreation::Subscription
8
8
  end
9
9
 
10
10
  def subscriptions_in_organization
11
- subscriptions.joins(:discussion).where(discussion: discussions_in_organization)
11
+ subscriptions.where(discussion: Organization.current.discussions)
12
12
  end
13
13
 
14
14
  def subscribed_to?(discussion)
@@ -7,7 +7,7 @@ module WithNotifications
7
7
 
8
8
  def unread_notifications
9
9
  # TODO: message and discussion should trigger a notification instead of being one
10
- all = notifications.where(read: false) + unread_messages + unread_discussions
10
+ all = notifications_in_organization.where(read: false) + unread_messages + unread_discussions
11
11
  all.sort_by(&:created_at).reverse
12
12
  end
13
13
 
@@ -0,0 +1,32 @@
1
+ module WithOrganizationStatus
2
+
3
+ def status
4
+ @status ||= _status
5
+ end
6
+
7
+ def access_mode(user)
8
+ status.access_mode(user)
9
+ end
10
+
11
+ def validate_active!
12
+ status.validate!
13
+ end
14
+
15
+ def validate_active_for!(user)
16
+ status.validate!(user)
17
+ access_mode(user).validate_active!
18
+ end
19
+
20
+ private
21
+
22
+ def _status
23
+ if disabled?
24
+ Organization::Status::Disabled.new self
25
+ elsif in_preparation?
26
+ Organization::Status::InPreparation.new self
27
+ else
28
+ Organization::Status::Enabled.new self
29
+ end
30
+ end
31
+
32
+ end
@@ -7,6 +7,10 @@ module WithProgress
7
7
  progress_for(user, organization).completion_percentage
8
8
  end
9
9
 
10
+ def has_progress_for?(user, organization)
11
+ progress_for(user, organization).persisted?
12
+ end
13
+
10
14
  def dirty_progresses!
11
15
  Indicator.dirty_by_content_change! self
12
16
  end
@@ -10,7 +10,7 @@ module WithReminders
10
10
  end
11
11
 
12
12
  def remind!
13
- build_reminder.deliver_now
13
+ build_reminder.post!
14
14
  update! last_reminded_date: Time.current
15
15
  end
16
16
 
@@ -21,6 +21,7 @@ class Discussion < ApplicationRecord
21
21
  scope :no_responsible_moderator, -> { where('responsible_moderator_at < ?', Time.now - MODERATOR_MAX_RESPONSIBLE_TIME)
22
22
  .or(where(responsible_moderator_at: nil)) }
23
23
  scope :pending_review, -> { where(status: :pending_review) }
24
+ scope :unread_first, -> { includes(:subscriptions).reorder('subscriptions.read', created_at: :desc) }
24
25
 
25
26
  after_create :subscribe_initiator!
26
27
 
@@ -95,15 +96,15 @@ class Discussion < ApplicationRecord
95
96
  upvotes.find_by(user: user)
96
97
  end
97
98
 
98
- def unread_subscriptions(user)
99
- subscriptions.where.not(user: user).map(&:unread!)
99
+ def mark_subscriptions_as_unread!(user)
100
+ subscriptions.where.not(user: user).each(&:unread!)
100
101
  end
101
102
 
102
103
  def submit_message!(message, user)
103
104
  message.merge!(sender: user.uid)
104
105
  messages.create(message)
105
106
  user.subscribe_to! self
106
- unread_subscriptions(user)
107
+ mark_subscriptions_as_unread!(user)
107
108
  no_responsible! if responsible?(user)
108
109
  end
109
110
 
@@ -182,6 +183,11 @@ class Discussion < ApplicationRecord
182
183
  klazz.constantize.find(debatable_id)
183
184
  end
184
185
 
186
+ # TODO remove this once discussions generate notifications
187
+ def subject
188
+ 'discussion'
189
+ end
190
+
185
191
  private
186
192
 
187
193
  def messages_by_updated_at(direction = :desc)
@@ -32,6 +32,6 @@ class ExamAuthorizationRequest < ApplicationRecord
32
32
  private
33
33
 
34
34
  def notify_user!
35
- Notification.create! organization: organization, user: user, target: self if saved_change_to_status?
35
+ Notification.create_and_notify_via_email! organization: organization, user: user, target: self, subject: 'exam_authorization_request_updated' if saved_change_to_status?
36
36
  end
37
37
  end
@@ -73,9 +73,13 @@ class ExamRegistration < ApplicationRecord
73
73
  registrees.include? user
74
74
  end
75
75
 
76
+ def meets_criterion?(user)
77
+ authorization_criterion.meets_criterion?(user, organization)
78
+ end
79
+
76
80
  private
77
81
 
78
82
  def notify_registree!(registree)
79
- Notification.create! organization: organization, user: registree, target: self
83
+ Notification.create_and_notify_via_email! organization: organization, user: registree, subject: :exam_registration, target: self
80
84
  end
81
85
  end
@@ -34,6 +34,10 @@ class ExamRegistration::AuthorizationCriterion
34
34
  rescue
35
35
  raise "Invalid criterion type #{type}"
36
36
  end
37
+
38
+ def meets_authorization_criteria?(authorization_request)
39
+ meets_criterion? authorization_request.user, authorization_request.organization
40
+ end
37
41
  end
38
42
 
39
43
  class ExamRegistration::AuthorizationCriterion::None < ExamRegistration::AuthorizationCriterion
@@ -45,7 +49,7 @@ class ExamRegistration::AuthorizationCriterion::None < ExamRegistration::Authori
45
49
  !value
46
50
  end
47
51
 
48
- def meets_authorization_criteria?(_authorization_request)
52
+ def meets_criterion?(_user, _organization)
49
53
  true
50
54
  end
51
55
  end
@@ -55,7 +59,7 @@ class ExamRegistration::AuthorizationCriterion::PassedExercises < ExamRegistrati
55
59
  value.positive?
56
60
  end
57
61
 
58
- def meets_authorization_criteria?(authorization_request)
59
- authorization_request.user.passed_submissions_count_in(authorization_request.organization) >= value
62
+ def meets_criterion?(user, organization)
63
+ user.passed_submissions_count_in(organization) >= value
60
64
  end
61
65
  end
@@ -127,6 +127,11 @@ class Message < ApplicationRecord
127
127
  end
128
128
  end
129
129
 
130
+ # TODO remove this once messages generate notifications
131
+ def subject
132
+ 'message'
133
+ end
134
+
130
135
  private
131
136
 
132
137
  def approve!(user)
@@ -1,8 +1,12 @@
1
1
  class Notification < ApplicationRecord
2
2
  belongs_to :user
3
3
  belongs_to :organization
4
- belongs_to :target, polymorphic: true
4
+ belongs_to :target, polymorphic: true, optional: true
5
5
 
6
+ enum subject: %i(
7
+ custom
8
+ exam_authorization_request_updated
9
+ exam_registration)
6
10
 
7
11
  scope :notified_users_ids_for, ->(target, organization=Organization.current) do
8
12
  where(target: target, organization: organization).pluck(:user_id)
@@ -11,4 +15,12 @@ class Notification < ApplicationRecord
11
15
  def mark_as_read!
12
16
  update read: true
13
17
  end
18
+
19
+ def self.create_and_notify_via_email!(args)
20
+ create!(args).tap(&:notify_via_email!)
21
+ end
22
+
23
+ def notify_via_email!
24
+ user.notify_via_email! self
25
+ end
14
26
  end
@@ -6,6 +6,7 @@ class Organization < ApplicationRecord
6
6
  include Mumukit::Login::OrganizationHelpers
7
7
 
8
8
  include WithTargetAudience
9
+ include WithOrganizationStatus
9
10
 
10
11
  serialize :profile, Mumuki::Domain::Organization::Profile
11
12
  serialize :settings, Mumuki::Domain::Organization::Settings
@@ -148,6 +149,10 @@ class Organization < ApplicationRecord
148
149
  [default_date, in_preparation_until&.to_date].compact.max
149
150
  end
150
151
 
152
+ def discussions
153
+ book.discussions_in_organization(self)
154
+ end
155
+
151
156
  # ==============
152
157
  # Display fields
153
158
  # ==============
@@ -0,0 +1,2 @@
1
+ module OrganizationAccessMode
2
+ end
@@ -0,0 +1,45 @@
1
+ class OrganizationAccessMode::Base
2
+ attr_reader :user, :organization
3
+
4
+ def initialize(user, organization)
5
+ @user = user
6
+ @organization = organization
7
+ end
8
+
9
+ def validate_active!
10
+ end
11
+
12
+ def faqs_here?
13
+ organization.faqs.present?
14
+ end
15
+
16
+ def submit_solutions_here?
17
+ false
18
+ end
19
+
20
+ def resolve_discussions_here?
21
+ false
22
+ end
23
+
24
+ def discuss_here?
25
+ organization.forum_enabled? && user.discusser_of?(organization) &&
26
+ user.trusted_as_discusser_in?(organization) && !user.banned_from_forum?
27
+ end
28
+
29
+ def show_discussion_element?
30
+ false
31
+ end
32
+
33
+ def show_content_element?
34
+ false
35
+ end
36
+
37
+ def validate_discuss_here!(_discussion)
38
+ raise Mumuki::Domain::ForbiddenError
39
+ end
40
+
41
+ def validate_content_here!(content)
42
+ raise Mumuki::Domain::ForbiddenError unless show_content?(content)
43
+ end
44
+ end
45
+
@@ -0,0 +1,5 @@
1
+ class OrganizationAccessMode::ComingSoon < OrganizationAccessMode::Forbidden
2
+ def validate_active!
3
+ raise Mumuki::Domain::UnpreparedOrganizationError
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ class OrganizationAccessMode::Forbidden < OrganizationAccessMode::Base
2
+ def validate_active!
3
+ raise Mumuki::Domain::ForbiddenError if organization.private? && user.present?
4
+ end
5
+
6
+ def faqs_here?
7
+ false
8
+ end
9
+
10
+ def profile_here?
11
+ false
12
+ end
13
+
14
+ def discuss_here?
15
+ false
16
+ end
17
+
18
+ def show_content?(_content)
19
+ false
20
+ end
21
+
22
+ end
@@ -0,0 +1,28 @@
1
+ class OrganizationAccessMode::Full < OrganizationAccessMode::Base
2
+ def profile_here?
3
+ true
4
+ end
5
+
6
+ def submit_solutions_here?
7
+ true
8
+ end
9
+
10
+ def show_discussion_element?
11
+ true
12
+ end
13
+
14
+ def resolve_discussions_here?
15
+ discuss_here?
16
+ end
17
+
18
+ def validate_discuss_here!(_discussion)
19
+ end
20
+
21
+ def show_content?(_content)
22
+ true
23
+ end
24
+
25
+ def show_content_element?
26
+ true
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ class OrganizationAccessMode::Gone < OrganizationAccessMode::Forbidden
2
+ def validate_active!
3
+ raise Mumuki::Domain::DisabledOrganizationError
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ class OrganizationAccessMode::ReadOnly < OrganizationAccessMode::Base
2
+ def initialize(user, organization, *global_scopes, **specific_scopes)
3
+ super user, organization
4
+ @scopes = global_scopes.map { |scope| [scope, :all] }.to_h.merge specific_scopes
5
+ end
6
+
7
+ def faqs_here?
8
+ has_scope(:faqs) && super
9
+ end
10
+
11
+ def profile_here?
12
+ has_scope(:profile)
13
+ end
14
+
15
+ def discuss_here?
16
+ has_scope(:discussions) && super
17
+ end
18
+
19
+ def validate_discuss_here!(discussion)
20
+ super(discussion) unless discussion&.initiator == user
21
+ end
22
+
23
+ def show_content?(content)
24
+ has_scope(:exercises) ||
25
+ (has_scope(:exercises, :submitted) && content.has_progress_for?(user, organization))
26
+ end
27
+
28
+ private
29
+
30
+ def has_scope(key, value = :all)
31
+ @scopes[key] == value
32
+ end
33
+ end
data/app/models/user.rb CHANGED
@@ -13,7 +13,7 @@ class User < ApplicationRecord
13
13
  Mumuki::Domain::Helpers::User
14
14
 
15
15
  serialize :permissions, Mumukit::Auth::Permissions
16
-
16
+ serialize :ignored_notifications, Array
17
17
 
18
18
  has_many :notifications
19
19
  has_many :assignments, foreign_key: :submitter_id
@@ -54,6 +54,8 @@ class User < ApplicationRecord
54
54
  resource_fields :uid, :social_id, :email, :permissions, :verified_first_name, :verified_last_name, *profile_fields
55
55
  with_temporary_token :delete_account_token
56
56
 
57
+ organic_on :notifications
58
+
57
59
  def last_lesson
58
60
  last_guide.try(:lesson)
59
61
  end
@@ -62,6 +64,10 @@ class User < ApplicationRecord
62
64
  messages.where('assignments.organization': organization)
63
65
  end
64
66
 
67
+ def notifications_in_organization(organization = Organization.current)
68
+ notifications.where(organization: organization)
69
+ end
70
+
65
71
  def passed_submissions_count_in(organization)
66
72
  assignments.where(top_submission_status: Mumuki::Domain::Status::Submission::Passed.to_i, organization: organization).count
67
73
  end
@@ -195,7 +201,7 @@ class User < ApplicationRecord
195
201
  # This is true only when this organization has the forum enabled and the user
196
202
  # has the discusser pseudo-permission and the discusser is trusted
197
203
  def can_discuss_in?(organization)
198
- organization.forum_enabled? && discusser_of?(organization) && trusted_as_discusser_in?(organization) && !banned_from_forum?
204
+ organization.access_mode(self).discuss_here?
199
205
  end
200
206
 
201
207
  def trusted_as_discusser_in?(organization)
@@ -277,6 +283,10 @@ class User < ApplicationRecord
277
283
  }
278
284
  end
279
285
 
286
+ def solved_any_exercises?(organization = Organization.current)
287
+ Assignment.exists?(organization: organization, submitter: self)
288
+ end
289
+
280
290
  def save_and_notify!
281
291
  save!
282
292
  notify_permissions_changed!
@@ -300,7 +310,7 @@ class User < ApplicationRecord
300
310
  def certificate_in(certificate_program, certificate_h)
301
311
  return if certificated_in?(certificate_program)
302
312
  certificate = certificates.create certificate_h.merge(certificate_program: certificate_program)
303
- UserMailer.certificate(certificate).deliver_later
313
+ UserMailer.certificate(certificate).post!
304
314
  end
305
315
 
306
316
  def clear_progress_for!(organization)
@@ -315,11 +325,19 @@ class User < ApplicationRecord
315
325
  user_stats.where(location).delete_all
316
326
  end
317
327
 
328
+ def notify_via_email!(notification)
329
+ UserMailer.notification(notification).post! unless ignores_notification? notification
330
+ end
331
+
332
+ def ignores_notification?(notification)
333
+ ignored_notifications.include? notification.subject
334
+ end
335
+
318
336
  private
319
337
 
320
338
  def welcome_to_new_organizations!
321
339
  new_accessible_organizations.each do |organization|
322
- UserMailer.welcome_email(self, organization).deliver_now rescue nil if organization.greet_new_users?
340
+ UserMailer.welcome_email(self, organization).post! rescue nil if organization.greet_new_users?
323
341
  end
324
342
  end
325
343
 
@@ -11,7 +11,7 @@ class UserStats < ApplicationRecord
11
11
  end
12
12
 
13
13
  def activity(date_range = nil)
14
- date_filter = { updated_at: date_range }.compact
14
+ date_filter = { submitted_at: date_range }.compact
15
15
  {
16
16
  exercises: {
17
17
  solved_count: organization_exercises
@@ -0,0 +1,8 @@
1
+ class AddNewFieldsToNotifications < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :notifications, :subject, :integer
4
+ add_column :notifications, :custom_title, :text
5
+ add_column :notifications, :custom_content_plain_text, :text
6
+ add_column :notifications, :custom_content_html, :text
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddIgnoredNotificationsToUsers < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :users, :ignored_notifications, :text
4
+ end
5
+ end
@@ -52,11 +52,6 @@ module Mumuki::Domain::Helpers::Organization
52
52
  Mumukit::Platform.application.organic_domain(name)
53
53
  end
54
54
 
55
- def validate_active!
56
- raise Mumuki::Domain::DisabledOrganizationError if disabled?
57
- raise Mumuki::Domain::UnpreparedOrganizationError if in_preparation?
58
- end
59
-
60
55
  ## API Exposure
61
56
 
62
57
  def to_param
@@ -16,6 +16,22 @@ module Mumuki::Domain
16
16
  false
17
17
  end
18
18
 
19
+ def ex_student_of?(*)
20
+ false
21
+ end
22
+
23
+ def ex_student_here?
24
+ false
25
+ end
26
+
27
+ def student_of?(*)
28
+ false
29
+ end
30
+
31
+ def student_here?
32
+ false
33
+ end
34
+
19
35
  def teacher_here?
20
36
  false
21
37
  end
@@ -28,7 +28,7 @@ class Mumuki::Domain::Organization::Settings < Mumukit::Platform::Model
28
28
  end
29
29
 
30
30
  def forum_discussions_minimal_role
31
- (@forum_discussions_minimal_role || 'student').to_sym
31
+ (@forum_discussions_minimal_role || 'ex_student').to_sym
32
32
  end
33
33
 
34
34
  def disabled_from=(disabled_from)
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '9.9.0'
3
+ VERSION = '9.13.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: 9.9.0
4
+ version: 9.13.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: 2021-07-15 00:00:00.000000000 Z
11
+ date: 2021-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '7.9'
33
+ version: '7.11'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '7.9'
40
+ version: '7.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mumukit-assistant
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.7'
75
+ version: '1.11'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.7'
82
+ version: '1.11'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mumukit-core
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -265,6 +265,10 @@ files:
265
265
  - app/models/concerns/navigation/siblings_navigation.rb
266
266
  - app/models/concerns/navigation/terminal_navigation.rb
267
267
  - app/models/concerns/onomastic.rb
268
+ - app/models/concerns/organization/status/base.rb
269
+ - app/models/concerns/organization/status/disabled.rb
270
+ - app/models/concerns/organization/status/enabled.rb
271
+ - app/models/concerns/organization/status/in_preparation.rb
268
272
  - app/models/concerns/submittable/confirmable.rb
269
273
  - app/models/concerns/submittable/queriable.rb
270
274
  - app/models/concerns/submittable/questionable.rb
@@ -292,6 +296,7 @@ files:
292
296
  - app/models/concerns/with_name.rb
293
297
  - app/models/concerns/with_notifications.rb
294
298
  - app/models/concerns/with_number.rb
299
+ - app/models/concerns/with_organization_status.rb
295
300
  - app/models/concerns/with_pg_lock.rb
296
301
  - app/models/concerns/with_preferences.rb
297
302
  - app/models/concerns/with_profile.rb
@@ -336,6 +341,13 @@ files:
336
341
  - app/models/message.rb
337
342
  - app/models/notification.rb
338
343
  - app/models/organization.rb
344
+ - app/models/organization_access_mode.rb
345
+ - app/models/organization_access_mode/base.rb
346
+ - app/models/organization_access_mode/coming_soon.rb
347
+ - app/models/organization_access_mode/forbidden.rb
348
+ - app/models/organization_access_mode/full.rb
349
+ - app/models/organization_access_mode/gone.rb
350
+ - app/models/organization_access_mode/read_only.rb
339
351
  - app/models/preferences.rb
340
352
  - app/models/progress.rb
341
353
  - app/models/stats.rb
@@ -672,6 +684,8 @@ files:
672
684
  - db/migrate/20210512200453_add_processed_flag_to_exam_registration.rb
673
685
  - db/migrate/20210518100153_rename_last_moderator_access.rb
674
686
  - db/migrate/20210707143002_add_assignment_id_to_message.rb
687
+ - db/migrate/20210719145706_add_new_fields_to_notifications.rb
688
+ - db/migrate/20210803175124_add_ignored_notifications_to_users.rb
675
689
  - lib/mumuki/domain.rb
676
690
  - lib/mumuki/domain/area.rb
677
691
  - lib/mumuki/domain/engine.rb