mumuki-domain 9.7.0 → 9.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/discussion.rb +15 -2
- data/app/models/user_stats.rb +1 -1
- data/lib/mumuki/domain/status/discussion/closed.rb +4 -0
- data/lib/mumuki/domain/status/discussion/opened.rb +4 -0
- data/lib/mumuki/domain/status/discussion/pending_review.rb +4 -0
- data/lib/mumuki/domain/status/discussion/solved.rb +4 -0
- data/lib/mumuki/domain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 801f11c820f31c39323edff06d235e0c48804b1454f5dbd118363a34f153808f
|
4
|
+
data.tar.gz: daaa6a61637d5d52412fee38276de7c2ebad10cb696f28b912cbe4ef3ca49247
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b0370b955ddf9ae29c02dde36613b1bde7fcd3c3711e55f20744bcdcd283e711f461ad6ab2766b0b560fa7e845a401a2cf0172d4a04d7223eb93671ea85e95f
|
7
|
+
data.tar.gz: 1ea134ed3fe1ac847c524eff4479463f7a75c6d96ef2ecdcb6ef2c62162c38ab0effaae3e76da02c57666418747fd01753c3b369f5a0dae1058b794dac22c067
|
data/app/models/discussion.rb
CHANGED
@@ -15,14 +15,19 @@ class Discussion < ApplicationRecord
|
|
15
15
|
|
16
16
|
scope :by_language, -> (language) { includes(:exercise).joins(exercise: :language).where(languages: {name: language}) }
|
17
17
|
scope :order_by_responses_count, -> (direction) { reorder(validated_messages_count: direction, messages_count: opposite(direction)) }
|
18
|
-
scope :
|
18
|
+
scope :by_requires_attention, -> (boolean) { opened_and_requires_moderator_response(boolean).or(pending_review).no_responsible_moderator }
|
19
|
+
scope :opened_and_requires_moderator_response, -> (boolean) { where(requires_moderator_response: boolean.to_boolean)
|
20
|
+
.where(status: :opened) }
|
21
|
+
scope :no_responsible_moderator, -> { where('responsible_moderator_at < ?', Time.now - MODERATOR_MAX_RESPONSIBLE_TIME)
|
22
|
+
.or(where(responsible_moderator_at: nil)) }
|
23
|
+
scope :pending_review, -> { where(status: :pending_review) }
|
19
24
|
|
20
25
|
after_create :subscribe_initiator!
|
21
26
|
|
22
27
|
markdown_on :description
|
23
28
|
|
24
29
|
sortable :responses_count, :upvotes_count, :created_at, default: :created_at_desc
|
25
|
-
filterable :status, :language, :
|
30
|
+
filterable :status, :language, :requires_attention
|
26
31
|
pageable
|
27
32
|
|
28
33
|
delegate :language, to: :item
|
@@ -145,6 +150,14 @@ class Discussion < ApplicationRecord
|
|
145
150
|
validated_messages_count > 0
|
146
151
|
end
|
147
152
|
|
153
|
+
def requires_attention_for?(user)
|
154
|
+
user&.moderator_here? && requires_attention?
|
155
|
+
end
|
156
|
+
|
157
|
+
def requires_attention?
|
158
|
+
no_current_responsible? && status.requires_attention_for?(self)
|
159
|
+
end
|
160
|
+
|
148
161
|
def subscribe_initiator!
|
149
162
|
initiator.subscribe_to! self
|
150
163
|
end
|
data/app/models/user_stats.rb
CHANGED
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.
|
4
|
+
version: 9.8.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-
|
11
|
+
date: 2021-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|