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
20c07e00
Commit
20c07e00
authored
Nov 13, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude own actions from notifications (issue #147)
parent
22a68aad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
12 deletions
+18
-12
weblate/accounts/models.py
weblate/accounts/models.py
+12
-8
weblate/trans/models.py
weblate/trans/models.py
+4
-2
weblate/trans/views.py
weblate/trans/views.py
+2
-2
No files found.
weblate/accounts/models.py
View file @
20c07e00
...
...
@@ -97,20 +97,24 @@ class ProfileManager(models.Manager):
'''
Manager providing shortcuts for subscription queries.
'''
def
subscribed_any_translation
(
self
,
project
,
language
):
return
self
.
filter
(
subscribe_any_translation
=
True
,
subscriptions
=
project
,
languages
=
language
)
def
subscribed_any_translation
(
self
,
project
,
language
,
user
):
return
self
.
filter
(
subscribe_any_translation
=
True
,
subscriptions
=
project
,
languages
=
language
)
.
exclude
(
user
=
user
)
def
subscribed_new_string
(
self
,
project
,
language
):
return
self
.
filter
(
subscribe_new_string
=
True
,
subscriptions
=
project
,
languages
=
language
)
def
subscribed_new_suggestion
(
self
,
project
,
language
):
return
self
.
filter
(
subscribe_new_suggestion
=
True
,
subscriptions
=
project
,
languages
=
language
)
def
subscribed_new_suggestion
(
self
,
project
,
language
,
user
):
ret
=
self
.
filter
(
subscribe_new_suggestion
=
True
,
subscriptions
=
project
,
languages
=
language
)
# We don't want to filter out anonymous user
if
user
.
is_authenticated
():
ret
=
ret
.
exclude
(
user
=
user
)
return
ret
def
subscribed_new_contributor
(
self
,
project
,
language
):
return
self
.
filter
(
subscribe_new_contributor
=
True
,
subscriptions
=
project
,
languages
=
language
)
def
subscribed_new_contributor
(
self
,
project
,
language
,
user
):
return
self
.
filter
(
subscribe_new_contributor
=
True
,
subscriptions
=
project
,
languages
=
language
)
.
exclude
(
user
=
user
)
def
subscribed_new_comment
(
self
,
project
,
language
):
ret
=
self
.
filter
(
subscribe_new_comment
=
True
,
subscriptions
=
project
)
def
subscribed_new_comment
(
self
,
project
,
language
,
user
):
ret
=
self
.
filter
(
subscribe_new_comment
=
True
,
subscriptions
=
project
)
.
exclude
(
user
=
user
)
# Source comments go to every subscriber
if
language
is
not
None
:
ret
=
ret
.
filter
(
languages
=
language
)
...
...
weblate/trans/models.py
View file @
20c07e00
...
...
@@ -2150,7 +2150,8 @@ class Unit(models.Model):
# Notify subscribed users about new translation
subscriptions
=
Profile
.
objects
.
subscribed_any_translation
(
self
.
translation
.
subproject
.
project
,
self
.
translation
.
language
self
.
translation
.
language
,
request
.
user
)
for
subscription
in
subscriptions
:
subscription
.
notify_any_translation
(
self
,
oldunit
)
...
...
@@ -2160,7 +2161,8 @@ class Unit(models.Model):
# Get list of subscribers for new contributor
subscriptions
=
Profile
.
objects
.
subscribed_new_contributor
(
self
.
translation
.
subproject
.
project
,
self
.
translation
.
language
self
.
translation
.
language
,
request
.
user
)
for
subscription
in
subscriptions
:
subscription
.
notify_new_contributor
(
self
.
translation
,
request
.
user
)
...
...
weblate/trans/views.py
View file @
20c07e00
...
...
@@ -915,7 +915,7 @@ def translate(request, project, subproject, lang):
unit
.
translation
.
invalidate_cache
(
'suggestions'
)
# Notify subscribed users
from
weblate.accounts.models
import
Profile
subscriptions
=
Profile
.
objects
.
subscribed_new_suggestion
(
obj
.
subproject
.
project
,
obj
.
language
)
subscriptions
=
Profile
.
objects
.
subscribed_new_suggestion
(
obj
.
subproject
.
project
,
obj
.
language
,
request
.
user
)
for
subscription
in
subscriptions
:
subscription
.
notify_new_suggestion
(
obj
,
sug
)
# Update suggestion stats
...
...
@@ -1191,7 +1191,7 @@ def comment(request, pk):
messages
.
info
(
request
,
_
(
'Posted new comment'
))
# Notify subscribed users
from
weblate.accounts.models
import
Profile
,
send_notification_email
subscriptions
=
Profile
.
objects
.
subscribed_new_comment
(
obj
.
translation
.
subproject
.
project
,
lang
)
subscriptions
=
Profile
.
objects
.
subscribed_new_comment
(
obj
.
translation
.
subproject
.
project
,
lang
,
request
.
user
)
for
subscription
in
subscriptions
:
subscription
.
notify_new_comment
(
obj
,
comment
)
# Notify upstream
...
...
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