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
defd7651
Commit
defd7651
authored
Oct 08, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out code for iterating over components with unique repos
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
cf1807b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
18 deletions
+23
-18
weblate/trans/models/project.py
weblate/trans/models/project.py
+19
-0
weblate/trans/views/js.py
weblate/trans/views/js.py
+4
-18
No files found.
weblate/trans/models/project.py
View file @
defd7651
...
...
@@ -447,6 +447,25 @@ class Project(models.Model, PercentMixin, URLMixin, PathMixin):
return
None
return
max
(
changes
)
def
all_repo_components
(
self
):
"""Returns list of all unique VCS components."""
result
=
list
(
self
.
subproject_set
.
exclude
(
repo__startswith
=
'weblate://'
)
)
included
=
set
(
[
component
.
get_repo_link_url
()
for
component
in
result
]
)
result
.
extend
(
self
.
subproject_set
.
filter
(
repo__startswith
=
'weblate://'
).
exclude
(
repo__in
=
included
)
)
return
result
@
receiver
(
m2m_changed
,
sender
=
User
.
user_permissions
.
through
)
def
user_permissions_changed
(
sender
,
instance
,
action
,
**
kwargs
):
...
...
weblate/trans/views/js.py
View file @
defd7651
...
...
@@ -139,24 +139,10 @@ def git_status_project(request, project):
if
not
can_see_repository_status
(
request
.
user
,
obj
):
raise
PermissionDenied
()
statuses
=
[]
included
=
set
()
not_linked
=
obj
.
subproject_set
.
exclude
(
repo__startswith
=
'weblate://'
)
linked
=
obj
.
subproject_set
.
filter
(
repo__startswith
=
'weblate://'
)
for
subproject
in
not_linked
:
statuses
.
append
((
subproject
.
__unicode__
(),
subproject
.
repository
.
status
,
))
included
.
add
(
subproject
.
get_repo_link_url
())
for
subproject
in
linked
.
exclude
(
repo__in
=
included
):
statuses
.
append
((
subproject
.
__unicode__
(),
subproject
.
repository
.
status
,
))
statuses
=
[
(
component
.
__unicode__
(),
component
.
repository
.
status
)
for
component
in
obj
.
all_repo_components
()
]
return
render
(
request
,
...
...
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