Only video uploader can edit their subtitles
authorsaksham1115 <saksham115@gmail.com>
Wed, 13 Jul 2016 15:09:49 +0000 (15:09 +0000)
committersaksham1115 <saksham115@gmail.com>
Tue, 19 Jul 2016 17:29:24 +0000 (17:29 +0000)
mediagoblin/edit/views.py
mediagoblin/templates/mediagoblin/user_pages/media.html
mediagoblin/user_pages/routing.py

index 6b22fbae7f216dc27944cfbc540f5b9066515bad..eb9334e954fc75ba5dd48cc484ab315a7177545c 100644 (file)
@@ -584,8 +584,10 @@ def edit_metadata(request, media):
 from mediagoblin.tools.subtitles import open_subtitle,save_subtitle
 
 @require_active_login
+@get_media_entry_by_id
+@user_may_delete_media
 @path_subtitle
-def custom_subtitles(request,path=None):
+def custom_subtitles(request,media,path=None):
     text = open_subtitle(path)
     form = forms.CustomizeSubtitlesForm(request.form,
                                          subtitle=text)
index f7997571423e05f711b1394d27ce9c55708a708a..2ba561dda7424a597e2048d2f1f7e6566316dba7 100644 (file)
           {%- for subtitle in media.subtitle_files %}
             <li>
                 <a href="{{ request.urlgen('mediagoblin.edit.custom_subtitles',
+                            user=media.get_actor.username,
+                            media_id=media.id,
                             path=subtitle.filepath) }}">
-                {{- subtitle.name -}}
+                {{- subtitle.name -}} 
             </li>
           {%- endfor %}
         </ul>
index 0165ab6c8e5b4e7a027aa50ecd627463b1fe2ce9..beb16a0f74176bb44bd845296c71d2f630e8cb40 100644 (file)
@@ -122,5 +122,5 @@ add_route('mediagoblin.edit.metadata',
 
 
 add_route('mediagoblin.edit.custom_subtitles',
-          '/c_s/<string:path>',
+          '/u/<string:user>/m/<int:media_id>/c_s/<string:path>',
           'mediagoblin.edit.views:custom_subtitles')
\ No newline at end of file