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
b61b9efe
Commit
b61b9efe
authored
Mar 08, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically add subscriptions when adding owners
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
647272ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
weblate/trans/models/__init__.py
weblate/trans/models/__init__.py
+15
-1
No files found.
weblate/trans/models/__init__.py
View file @
b61b9efe
...
...
@@ -21,9 +21,10 @@
import
os
import
shutil
from
django.db.models.signals
import
post_delete
,
post_save
from
django.db.models.signals
import
post_delete
,
post_save
,
m2m_changed
from
django.dispatch
import
receiver
from
weblate.accounts.models
import
Profile
from
weblate.trans.models.project
import
Project
from
weblate.trans.models.subproject
import
SubProject
from
weblate.trans.models.translation
import
Translation
...
...
@@ -262,3 +263,16 @@ def user_commit_pending(sender, instance, **kwargs):
last_author
=
translation
.
change_set
.
content
()[
0
].
author
if
last_author
==
instance
:
translation
.
commit_pending
(
None
)
@
receiver
(
m2m_changed
,
sender
=
Profile
.
subscriptions
.
through
)
def
add_user_subscription
(
sender
,
instance
,
action
,
reverse
,
model
,
pk_set
,
**
kwargs
):
if
action
!=
'post_add'
:
return
targets
=
model
.
objects
.
filter
(
pk__in
=
pk_set
)
if
reverse
:
for
target
in
targets
:
instance
.
add_subscription
(
target
.
user
)
else
:
for
target
in
targets
:
target
.
add_subscription
(
instance
.
user
)
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