1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-26 17:38:21 +01:00

Merge pull request #24 from lxsang/master

support author notification
This commit is contained in:
Xuan Sang LE 2020-09-22 19:51:29 +02:00 committed by GitHub
commit d96a9c699e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View File

@ -57,6 +57,10 @@
target: "quick_talk_comment_thread",
api_uri: "https://chat.iohub.dev/comment",
uri: "<?=url?>",
author: {
first: "mrsang",
last: "iohub.dev"
},
onload: function(){
renderMathInElement($("#desktop")[0]);
$('pre code').each(function(i, block) {

View File

@ -149,6 +149,10 @@ local url = __main__:get("url")
target: "quick_talk_comment_thread",
api_uri: "https://chat.iohub.dev/comment",
uri: "<?=url?>",
author: {
first: "mrsang",
last: "iohub.dev"
},
onload: function(){
renderMathInElement($("#book")[0]);
$('pre code').each(function(i, block) {

View File

@ -164,6 +164,10 @@ class QuickTalk {
content: ta.value,
},
};
if (this.options.author) {
data.author =
this.options.author.first + "@" + this.options.author.last;
}
this.request(this.options.api_uri + "/post", data, (ret) => {
if (ret.result) {
// TODO: more check goes here

View File

@ -111,7 +111,14 @@ function CommentController:post(...)
rq.comment.id = self.comment.db:lastInsertID()
rq.comment.content = process_md(rq.comment.content)
-- notify the author
if rq.author then
sendmail(rq.author, rq.comment.name ..
" has commented on one of your pages",
rq.comment.name .. " has commented on your page: " ..
rq.page.uri ..
".\nBest regards,\nEmail automatically sent by QuickTalk API")
end
-- send mail to all users of current page
local cmts, cmti = self.comment:select("MIN(id) as id,email",
"pid=" .. rq.comment.pid ..
@ -125,7 +132,7 @@ function CommentController:post(...)
rq.comment.name ..
" has written something on a page that you've commented. \nPlease visit this page: " ..
rq.page.uri ..
" for updates on the discussion.\nBest regard,\nEmail automatically sent by QuickTalk API")
" for updates on the discussion.\nBest regards,\nEmail automatically sent by QuickTalk API")
end
end
rq.comment.email = ""