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
2f13c99d
Commit
2f13c99d
authored
Apr 08, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed suggestion adding after refactor
parent
37b6793f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
trans/models/unit.py
trans/models/unit.py
+5
-3
trans/views/edit.py
trans/views/edit.py
+2
-1
No files found.
trans/models/unit.py
View file @
2f13c99d
...
@@ -879,10 +879,12 @@ class Unit(models.Model):
...
@@ -879,10 +879,12 @@ class Unit(models.Model):
position__lte
=
self
.
position
+
appsettings
.
NEARBY_MESSAGES
,
position__lte
=
self
.
position
+
appsettings
.
NEARBY_MESSAGES
,
)
)
def
add_suggestion
(
self
,
target
):
def
add_suggestion
(
self
,
target
,
user
):
'''
'''
Creates new suggestion for this unit.
Creates new suggestion for this unit.
'''
'''
from
trans.models.unitdata
import
Suggestion
,
Change
# Create the suggestion
# Create the suggestion
Suggestion
.
objects
.
create
(
Suggestion
.
objects
.
create
(
target
=
target
,
target
=
target
,
...
@@ -893,9 +895,9 @@ class Unit(models.Model):
...
@@ -893,9 +895,9 @@ class Unit(models.Model):
)
)
# Record in change
# Record in change
Change
.
objects
.
create
(
Change
.
objects
.
create
(
unit
=
unit
,
unit
=
self
,
action
=
Change
.
ACTION_SUGGESTION
,
action
=
Change
.
ACTION_SUGGESTION
,
translation
=
unit
.
translation
,
translation
=
self
.
translation
,
user
=
user
user
=
user
)
)
# Update suggestion count
# Update suggestion count
...
...
trans/views/edit.py
View file @
2f13c99d
...
@@ -110,7 +110,8 @@ def translate(request, project, subproject, lang):
...
@@ -110,7 +110,8 @@ def translate(request, project, subproject, lang):
)
)
# Create the suggestion
# Create the suggestion
unit
.
add_suggestion
(
unit
.
add_suggestion
(
join_plural
(
form
.
cleaned_data
[
'target'
])
join_plural
(
form
.
cleaned_data
[
'target'
]),
user
)
)
# Invite user to become translator if there is nobody else
# Invite user to become translator if there is nobody else
recent_changes
=
Change
.
objects
.
content
().
filter
(
recent_changes
=
Change
.
objects
.
content
().
filter
(
...
...
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