projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try to prevent multiple insertion of the same replies.
[Sone.git]
/
src
/
main
/
resources
/
static
/
javascript
/
sone.js
diff --git
a/src/main/resources/static/javascript/sone.js
b/src/main/resources/static/javascript/sone.js
index
3646f73
..
0d1772e
100644
(file)
--- a/
src/main/resources/static/javascript/sone.js
+++ b/
src/main/resources/static/javascript/sone.js
@@
-449,9
+449,9
@@
function ajaxifyPost(postElement) {
inputField = $(this.form).find(":input:enabled").get(0);
postId = getPostId(this);
text = $(inputField).val();
inputField = $(this.form).find(":input:enabled").get(0);
postId = getPostId(this);
text = $(inputField).val();
- $(inputField).val("");
postReply(postId, text, function(success, error, replyId) {
if (success) {
postReply(postId, text, function(success, error, replyId) {
if (success) {
+ $(inputField).val("");
loadNewReply(replyId);
markPostAsKnown(getPostElement(inputField));
$("#sone .post#" + postId + " .create-reply").addClass("hidden");
loadNewReply(replyId);
markPostAsKnown(getPostElement(inputField));
$("#sone .post#" + postId + " .create-reply").addClass("hidden");
@@
-707,8
+707,11
@@
function loadNewReply(replyId) {
if (replyId in loadedReplies) {
return;
}
if (replyId in loadedReplies) {
return;
}
- loadedReplies[replyId] = true;
$.getJSON("getReply.ajax", { "reply": replyId }, function(data, textStatus) {
$.getJSON("getReply.ajax", { "reply": replyId }, function(data, textStatus) {
+ if (replyId in loadedReplies) {
+ return;
+ }
+ loadedReplies[replyId] = true;
/* find post. */
if ((data != null) && data.success) {
$("#sone .post#" + data.reply.postId).each(function() {
/* find post. */
if ((data != null) && data.success) {
$("#sone .post#" + data.reply.postId).each(function() {
@@
-732,6
+735,7
@@
function loadNewReply(replyId) {
ajaxifyReply(newReply);
newReply.slideDown();
setActivity();
ajaxifyReply(newReply);
newReply.slideDown();
setActivity();
+ return false;
});
}
});
});
}
});