fixed deleting

This commit is contained in:
jeena 2013-09-09 08:31:25 +02:00
parent e8392eff7a
commit 61a2199fe3
4 changed files with 14 additions and 7 deletions

View file

@ -282,7 +282,7 @@ aside {
visibility: hidden;
}
.repost, .remove {
.repost {
display: none; /* FIXME: remove this; */
}

View file

@ -43,7 +43,9 @@ function(HostApp, Timeline, URI, APICalls, Core) {
var status = statuses.posts[i];
var name = bungloo.cache.profiles[status.entity] ? bungloo.cache.profiles[status.entity].name : status.entity
if(!append) HostApp.notificateUserAboutMention(status.content.text, name, status.id, status.entity);
if(!append && status.type.startsWith("https://tent.io/types/status/v0#")) {
HostApp.notificateUserAboutMention(status.content.text, name, status.id, status.entity);
}
}
}

View file

@ -77,7 +77,7 @@ function(Core, APICalls, HostApp, URI) {
this.since_time = status.received_at;
}
if (status.type == "https://tent.io/types/status/v0#" || status.type == "https://tent.io/types/status/v0#reply") {
if (status.type.startsWith("https://tent.io/types/status/v0#")) {
var new_node = this.getStatusDOMElement(status);
@ -97,9 +97,9 @@ function(Core, APICalls, HostApp, URI) {
}
}
} else if (status.type == "https://tent.io/types/post/delete/v0.1.0") {
} else if (status.type == "https://tent.io/types/delete/v0#") {
HostApp.notificateViewsAboutDeletedPost(status.content.id, status.entity);
HostApp.notificateViewsAboutDeletedPost(status.refs[0].post, status.entity);
} else if (status.type == "https://tent.io/types/post/repost/v0.1.0") {

View file

@ -503,8 +503,13 @@ function(jQuery, APICalls, URI, HostApp, Markdown) {
Core.prototype.remove = function(id, callback, type) {
type = type || "post";
if (confirm("Really delete this " + type + "?")) {
var url = URI(APICalls.mkApiRootPath("/posts/" + id));
APICalls.http_call(url.toString(), "DELETE", callback);
var entity = HostApp.stringForKey("entity");
var url = HostApp.serverUrl("post")
.replace(/\{entity\}/, encodeURIComponent(entity))
.replace(/\{post\}/, id);
APICalls.delete(url, { callback: callback });
}
}