Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
a7608db6
Commit
a7608db6
authored
7 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Added notifications for edits, closes #116
parent
32dc398a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
edit.py
+14
-2
14 additions, 2 deletions
edit.py
encoding.py
+3
-3
3 additions, 3 deletions
encoding.py
with
17 additions
and
5 deletions
edit.py
+
14
−
2
View file @
a7608db6
...
...
@@ -144,9 +144,9 @@ def edit(prefix='', ignore=[]):
path
[
'
table
'
],
path
[
'
id
'
],
path
[
'
tableinfo
'
][
'
idcolumn
'
],
path
[
'
column
'
],
val
,
path
[
'
id
'
],
datetime
.
now
(),
session
[
'
user
'
][
'
dbid
'
])
modify
(
'
UPDATE %s SET `%s` = ?, time_updated = ? WHERE `%s` = ?
'
%
(
path
[
'
tableinfo
'
][
'
table
'
],
path
[
'
column
'
],
path
[
'
tableinfo
'
][
'
idcolumn
'
]),
val
,
datetime
.
now
(),
path
[
'
id
'
])
for
func
in
edit_handlers
.
get
(
path
[
'
table
'
],
{}).
get
(
None
,
[]):
func
(
path
[
'
table
'
],
path
[
'
column
'
],
val
,
path
[
'
id
'
])
func
(
path
[
'
table
'
],
path
[
'
column
'
],
val
,
path
[
'
id
'
]
,
session
[
'
user
'
][
'
dbid
'
]
)
for
func
in
edit_handlers
.
get
(
path
[
'
table
'
],
{}).
get
(
path
[
'
column
'
],
[]):
func
(
path
[
'
table
'
],
path
[
'
column
'
],
val
,
path
[
'
id
'
])
func
(
path
[
'
table
'
],
path
[
'
column
'
],
val
,
path
[
'
id
'
]
,
session
[
'
user
'
][
'
dbid
'
]
)
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
return
"
OK
"
,
200
...
...
@@ -222,3 +222,15 @@ def edit_handler(*tables, field=None):
return
func
return
wrapper
@edit_handler
(
'
courses
'
)
@edit_handler
(
'
lectures
'
)
def
notify_edit
(
table
,
column
,
value
,
id
,
user_id
):
lecture
=
None
if
table
==
'
lectures
'
:
lecture
=
query
(
'
SELECT * FROM lectures_data WHERE id = ?
'
,
id
)[
0
]
course_id
=
lecture
[
'
course_id
'
]
elif
table
==
'
courses
'
:
course_id
=
id
course
=
query
(
'
SELECT * FROM courses_data WHERE id = ?
'
,
course_id
)[
0
]
user
=
query
(
'
SELECT * FROM users WHERE id = ?
'
,
user_id
)[
0
]
notify_mods
(
'
edit
'
,
course_id
,
exclude_uids
=
[
user_id
],
course
=
course
,
lecture
=
lecture
,
table
=
table
,
column
=
column
,
value
=
value
,
user
=
user
)
This diff is collapsed.
Click to expand it.
encoding.py
+
3
−
3
View file @
a7608db6
...
...
@@ -113,7 +113,7 @@ def update_lecture_videos(jobid, jobtype, data, state, status):
schedule_transcode
(
latest
,
video
=
video
)
@edit_handler
(
'
chapters
'
)
def
chapter_changed
(
table
,
column
,
value
,
id
):
def
chapter_changed
(
table
,
column
,
value
,
id
,
user
):
print
(
'
chapter_changed
'
)
chapters
=
query
(
'
SELECT * FROM chapters WHERE id = ?
'
,
id
)
if
not
chapters
:
...
...
@@ -123,7 +123,7 @@ def chapter_changed(table, column, value, id):
schedule_remux
(
chapter
[
'
lecture_id
'
])
@edit_handler
(
'
courses
'
)
def
course_changed
(
table
,
column
,
value
,
id
):
def
course_changed
(
table
,
column
,
value
,
id
,
user
):
if
column
not
in
[
'
title
'
,
'
organizer
'
]:
return
lectures
=
query
(
'
SELECT * FROM lectures WHERE course_id = ?
'
,
id
)
...
...
@@ -131,7 +131,7 @@ def course_changed(table, column, value, id):
schedule_remux
(
lecture
[
'
id
'
])
@edit_handler
(
'
lectures
'
)
def
lecture_changed
(
table
,
column
,
value
,
id
):
def
lecture_changed
(
table
,
column
,
value
,
id
,
user
):
if
column
in
[
'
title
'
,
'
comment
'
,
'
time
'
,
'
speaker
'
]:
schedule_remux
(
id
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment