* Redirect to comment after moderation (fix #358)
This commit is contained in:
parent
77871a8bab
commit
1b13458e6a
@ -109,5 +109,9 @@ In chronological order:
|
||||
* Craig P Hicks @craigphicks
|
||||
* Fix sub urls configurations on admin interface
|
||||
|
||||
* Chris Warrick @Kwpolska
|
||||
* Update Polish translation
|
||||
* Redirect to comment after moderation
|
||||
|
||||
* [Your name or handle] <[email or website]>
|
||||
* [Brief summary of your changes]
|
||||
|
@ -6,6 +6,7 @@ import re
|
||||
import cgi
|
||||
import time
|
||||
import functools
|
||||
import json # json.dumps to put URL in <script>
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from itsdangerous import SignatureExpired, BadSignature
|
||||
@ -589,6 +590,9 @@ class API(object):
|
||||
xhr = new XMLHttpRequest;
|
||||
xhr.open('POST', window.location.href);
|
||||
xhr.send(null);
|
||||
xhr.onload = function() {
|
||||
window.location.href = "https://example.com/example-thread/#isso-13";
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -603,6 +607,8 @@ class API(object):
|
||||
raise Forbidden
|
||||
|
||||
item = self.comments.get(id)
|
||||
thread = self.threads.get(item['tid'])
|
||||
link = local("origin") + thread["uri"] + "#isso-%i" % item["id"]
|
||||
|
||||
if item is None:
|
||||
raise NotFound
|
||||
@ -617,8 +623,11 @@ class API(object):
|
||||
" xhr = new XMLHttpRequest;"
|
||||
" xhr.open('POST', window.location.href);"
|
||||
" xhr.send(null);"
|
||||
" xhr.onload = function() {"
|
||||
" window.location.href = %s;"
|
||||
" };"
|
||||
" }"
|
||||
"</script>" % action.capitalize())
|
||||
"</script>" % (action.capitalize(), json.dumps(link)))
|
||||
|
||||
return Response(modal, 200, content_type="text/html")
|
||||
|
||||
@ -627,7 +636,6 @@ class API(object):
|
||||
return Response("Already activated", 200)
|
||||
with self.isso.lock:
|
||||
self.comments.activate(id)
|
||||
thread = self.threads.get(item['tid'])
|
||||
self.signal("comments.activate", thread, item)
|
||||
return Response("Yo", 200)
|
||||
elif action == "edit":
|
||||
|
Loading…
Reference in New Issue
Block a user