Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CoopStarter Data
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Startin blox
A
applications
Coop Starter
CoopStarter Data
Commits
86e8aa18
Commit
86e8aa18
authored
Sep 23, 2019
by
Benoit Alessandroni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding proper notifications to go back into the validation loop
parent
d3e54660
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
12 deletions
+50
-12
coopstarter_data/models.py
coopstarter_data/models.py
+33
-10
coopstarter_data/templates/resource_improvement_notification.txt
...rter_data/templates/resource_improvement_notification.txt
+1
-1
coopstarter_data/templates/reviewer_modification_notification.txt
...ter_data/templates/reviewer_modification_notification.txt
+15
-0
coopstarter_data/views.py
coopstarter_data/views.py
+1
-1
No files found.
coopstarter_data/models.py
View file @
86e8aa18
...
...
@@ -221,6 +221,28 @@ def create_review(sender, instance, created, **kwargs):
reviewInstance
=
Review
.
objects
.
create
(
resource
=
instance
,
status
=
"pending"
)
instance
.
review
=
reviewInstance
instance
.
save
()
if
not
created
:
#TODO: If we are updating a resource which requires improvement,
#we can send a notification to the current reviewer for further review
#and switch the review to pending
if
instance
.
review
.
status
==
'to_improve'
:
review
=
instance
.
review
review
.
status
=
'pending'
review
.
save
()
message
=
loader
.
render_to_string
(
'reviewer_modification_notification.txt'
,
{
'review'
:
review
,
'resource'
:
instance
}
)
send_mail
(
'The resource you reviewed has been modified'
,
message
,
review
.
reviewer
.
email
,
[
review
.
reviewer
.
email
]
)
@
receiver
(
post_save
,
sender
=
Review
)
def
update_review
(
sender
,
instance
,
created
,
**
kwargs
):
...
...
@@ -234,7 +256,7 @@ def update_review(sender, instance, created, **kwargs):
message
=
loader
.
render_to_string
(
'resource_validation_notification.txt'
,
{
'review'
:
instance
,
'review'
:
instance
,
'resource'
:
resource
}
)
...
...
@@ -242,22 +264,23 @@ def update_review(sender, instance, created, **kwargs):
message
=
loader
.
render_to_string
(
'resource_improvement_notification.txt'
,
{
'review'
:
instance
,
'review'
:
instance
,
'resource'
:
resource
}
)
el
se
:
el
if
instance
.
status
==
'inappropriate'
:
message
=
loader
.
render_to_string
(
'resource_refusal_notification.txt'
,
{
'review'
:
instance
,
'review'
:
instance
,
'resource'
:
resource
}
)
send_mail
(
'The resource you submitted have been reviewed'
,
message
,
resource
.
submitter
.
email
,
[
resource
.
submitter
.
email
]
)
\ No newline at end of file
if
instance
.
status
!=
'pending'
:
send_mail
(
'The resource you submitted has been reviewed'
,
message
,
resource
.
submitter
.
email
,
[
resource
.
submitter
.
email
]
)
\ No newline at end of file
coopstarter_data/templates/resource_improvement_notification.txt
View file @
86e8aa18
...
...
@@ -10,6 +10,6 @@ URI: {{resource.uri}}
Improvement proposal detail: {{review.comment}}
Have a nice day,
Connect to the Knowledge Base now to edit this resource.
The Knowledge Base Team.
\ No newline at end of file
coopstarter_data/templates/reviewer_modification_notification.txt
0 → 100644
View file @
86e8aa18
Hello {{review.reviewer.name|safe}}
{{resource.submitter.name|safe}} implemented the improvement you suggested on the following resource.
Title: {{resource.name}}
Description: {{resource.description}}
URI: {{resource.uri}}
Improvement proposal detail: {{review.comment}}
Connect now to validate it.
The Knowledge Base Team.
\ No newline at end of file
coopstarter_data/views.py
View file @
86e8aa18
...
...
@@ -7,4 +7,4 @@ class PendingResourcesViewSet(LDPViewSet):
def
get_queryset
(
self
,
*
args
,
**
kwargs
):
return
super
()
.
get_queryset
(
*
args
,
**
kwargs
)
\
.
filter
(
review__status
=
'pending'
,
language__in
=
self
.
request
.
user
.
mentor_profile
.
languages
.
all
(),
fields__in
=
self
.
request
.
user
.
mentor_profile
.
fields
.
all
())
\
.
exclude
(
submitter
=
self
.
request
.
user
)
\ No newline at end of file
.
exclude
(
submitter__username
=
self
.
request
.
user
.
username
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment