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
bcef5768
Commit
bcef5768
authored
Apr 17, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate trans.ignore_check permission check to new model
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
c65940b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
weblate/html/list-checks.html
weblate/html/list-checks.html
+4
-2
weblate/trans/permissions.py
weblate/trans/permissions.py
+8
-0
weblate/trans/templatetags/permissions.py
weblate/trans/templatetags/permissions.py
+5
-0
weblate/trans/views/js.py
weblate/trans/views/js.py
+5
-1
No files found.
weblate/html/list-checks.html
View file @
bcef5768
{% load i18n %}
{% can_ignore_check user check.project as user_can_ignore_check %}
{% for check in checks %}
<div
data-href=
"{% url 'js-ignore-check' check_id=check.id %}"
class=
"alert alert-{{ check.get_severity }} {% if
perms.trans.
ignore_check %}alert-dismissable{% endif %} check tooltip-control"
id=
"check-{{ check.id }}"
title=
"{{ check.get_description }}"
>
{% if
perms.trans.
ignore_check %}
<div
data-href=
"{% url 'js-ignore-check' check_id=check.id %}"
class=
"alert alert-{{ check.get_severity }} {% if
user_can_
ignore_check %}alert-dismissable{% endif %} check tooltip-control"
id=
"check-{{ check.id }}"
title=
"{{ check.get_description }}"
>
{% if
user_can_
ignore_check %}
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
title=
"{% blocktrans with check.get_check_display as check %}Ignore: {{ check }}{% endblocktrans %}"
>
×
</button>
{% endif %}
<a
href=
"{{ check.get_doc_url }}"
class=
"alert-link"
>
{{ check.get_check_display }}
</a>
...
...
weblate/trans/permissions.py
View file @
bcef5768
...
...
@@ -216,3 +216,11 @@ def can_edit_priority(user, project):
Checks whether user can edit translation priority.
"""
return
check_permission
(
user
,
project
,
'trans.edit_priority'
)
@
cache_permission
def
can_ignore_check
(
user
,
project
):
"""
Checks whether user can edit translation priority.
"""
return
check_permission
(
user
,
project
,
'trans.ignore_check'
)
weblate/trans/templatetags/permissions.py
View file @
bcef5768
...
...
@@ -101,3 +101,8 @@ def can_edit_flags(user, project):
@
register
.
assignment_tag
def
can_edit_priority
(
user
,
project
):
return
weblate
.
trans
.
permissions
.
can_edit_priority
(
user
,
project
)
@
register
.
assignment_tag
def
can_ignore_check
(
user
,
project
):
return
weblate
.
trans
.
permissions
.
can_ignore_check
(
user
,
project
)
weblate/trans/views/js.py
View file @
bcef5768
...
...
@@ -119,9 +119,13 @@ def get_unit_changes(request, unit_id):
)
@
permission_required
(
'trans.ignore_check'
)
@
login_required
def
ignore_check
(
request
,
check_id
):
obj
=
get_object_or_404
(
Check
,
pk
=
int
(
check_id
))
if
not
can_ignore_check
(
request
.
user
,
obj
.
project
):
raise
PermissionDenied
()
obj
.
project
.
check_acl
(
request
)
# Mark check for ignoring
obj
.
set_ignore
()
...
...
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