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