Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
389efc2a
Commit
389efc2a
authored
Jul 23, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented notifications for new suggestions (issue #59)
parent
8d2e4a51
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
weblate/html/mail/new_suggestion.txt
weblate/html/mail/new_suggestion.txt
+6
-2
weblate/trans/models.py
weblate/trans/models.py
+10
-3
weblate/trans/views.py
weblate/trans/views.py
+7
-1
No files found.
weblate/html/mail/new_suggestion.txt
View file @
389efc2a
...
...
@@ -5,10 +5,14 @@ there is new suggestion evaluate on {{ translation }} at {{ site_title }}.
{% trans "Source string:" %}
{{ suggestion.source }}
{{ suggestion.
get_
source }}
{% trans "Translation:" %}
{{ suggestion.get_target }}
{{ suggestion.target }}
{% trans "You can review it at:" %}
http://{{ current_site }}{{ suggestion.get_review_url }}
{% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %}
weblate/trans/models.py
View file @
389efc2a
...
...
@@ -1639,12 +1639,19 @@ class Suggestion(models.Model):
unit
.
fuzzy
=
False
unit
.
save_backend
(
request
,
False
)
def
get_
source
(
self
):
Unit
.
objects
.
filter
(
def
get_
matching_unit
(
self
):
return
Unit
.
objects
.
filter
(
checksum
=
self
.
checksum
,
translation__subproject__project
=
self
.
project
,
translation__language
=
self
.
language
,
)[
0
].
source
)[
0
]
def
get_source
(
self
):
return
self
.
get_matching_unit
().
source
def
get_review_url
(
self
):
return
self
.
get_matching_unit
().
get_absolute_url
()
CHECK_CHOICES
=
[(
x
,
CHECKS
[
x
].
name
)
for
x
in
CHECKS
]
...
...
weblate/trans/views.py
View file @
389efc2a
...
...
@@ -710,12 +710,18 @@ def translate(request, project, subproject, lang):
pos
,
search_url
))
Suggestion
.
objects
.
create
(
# Create the suggestion
sug
=
Suggestion
.
objects
.
create
(
target
=
join_plural
(
form
.
cleaned_data
[
'target'
]),
checksum
=
unit
.
checksum
,
language
=
unit
.
translation
.
language
,
project
=
unit
.
translation
.
subproject
.
project
,
user
=
user
)
# Notify subscribed users
from
weblate.accounts.models
import
Profile
subscriptions
=
Profile
.
objects
.
subscribed_new_suggestion
(
obj
.
subproject
.
project
,
obj
.
language
)
for
subscription
in
subscriptions
:
subscription
.
notify_new_suggestion
(
obj
,
sug
)
# Update suggestion stats
if
profile
is
not
None
:
profile
.
suggested
+=
1
...
...
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