force reauthentication to be able to send global cursor data

This commit is contained in:
Jeena Paradies 2013-01-16 01:03:55 +01:00
parent 084cc90321
commit 2d1293389f
3 changed files with 41 additions and 6 deletions

View file

@ -1,9 +1,11 @@
define([
"helper/HostApp",
"controller/Timeline"
"controller/Timeline",
"lib/URI",
"helper/Paths"
],
function(HostApp, Timeline) {
function(HostApp, Timeline, URI, Paths) {
function Mentions() {
@ -63,6 +65,37 @@ function(HostApp, Timeline) {
}
}
Mentions.prototype.setAllMentionsRead = function() {
this.unread_mentions = 0;
HostApp.unreadMentions(this.unread_mentions);
this.updateLatestMentionRead();
}
Mentions.prototype.updateLatestMentionRead = function() {
var status = this.body.firstChild.status;
if (status && status.type == "https://tent.io/types/post/status/v0.1.0") {
var url = URI(Paths.mkApiRootPath("/profile/" + encodeURIComponent("https://tent.io/types/info/cursor/v0.1.0")));
var body = {
"https://tent.io/types/info/cursor/v0.1.0": {
"mentions": {
"https://tent.io/types/post/status/v0.1.0": {
"post_id": status.id,
"post_entity": status.entity
}
}
}
}
var callback = function(resp) {
//debug(resp)
}
Paths.getURL(url.toString(), "PUT", callback, JSON.stringify(body));
}
}
return Mentions;