mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-12 16:07:59 +00:00
experimental post delivery indicator. requires twister-core update.
This commit is contained in:
parent
d0a94033c9
commit
0ef54f463e
@ -309,6 +309,7 @@
|
||||
<div class="post-info">
|
||||
<a href="#" class="post-info-name open-profile-modal"></a>
|
||||
<span class="post-info-tag"></span>
|
||||
<span class="post-info-sent"></span>
|
||||
<a class="post-info-time"></a>
|
||||
</div>
|
||||
<p class="post-text"></p>
|
||||
|
@ -86,6 +86,9 @@ function postToElem( post, kind, promoted ) {
|
||||
postInfoName.text(n).attr('href', $.MAL.userUrl(n));
|
||||
getFullname( n, postInfoName );
|
||||
//elem.find('.post-info-tag').text("@" + n);
|
||||
if( n === defaultScreenName ) {
|
||||
setPostInfoSent(n,k,elem.find('.post-info-sent'));
|
||||
}
|
||||
getAvatar( n, elem.find('.avatar') );
|
||||
elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t));
|
||||
|
||||
@ -141,6 +144,18 @@ function postToElem( post, kind, promoted ) {
|
||||
return elem;
|
||||
}
|
||||
|
||||
function setPostInfoSent(n, k, item) {
|
||||
getPostMaxAvailability(n,k,
|
||||
function(args,count) {
|
||||
if( count >= 3 ) { // assume 3 peers (me + 2) is enough for "sent"
|
||||
args.item.text("\u2713"); // check mark
|
||||
} else {
|
||||
args.item.text("\u231B"); // hour glass
|
||||
setTimeout(setPostInfoSent,2000,n,k,item);
|
||||
}
|
||||
}, {n:n,k:k,item:item});
|
||||
}
|
||||
|
||||
// format dmdata (returned by getdirectmsgs) to display in "snippet" per user list
|
||||
function dmDataToSnippetItem(dmData, remoteUser) {
|
||||
var dmItem = $("#dm-snippet-template").clone(true);
|
||||
|
@ -398,6 +398,15 @@ function getPostsCount( username, item ) {
|
||||
}, {username:username,item:item} );
|
||||
}
|
||||
|
||||
function getPostMaxAvailability(username, k, cbFunc, cbArg) {
|
||||
twisterRpc("getpiecemaxseen", [username,k],
|
||||
function(args, ret) {
|
||||
args.cbFunc(args.cbArg, ret);
|
||||
}, {cbFunc:cbFunc, cbArg:cbArg},
|
||||
function(args, ret) {
|
||||
console.log("getPostAvailability error");
|
||||
}, {cbFunc:cbFunc, cbArg:cbArg});
|
||||
}
|
||||
|
||||
function checkPubkeyExists(username, cbFunc, cbArg) {
|
||||
// pubkey is checked in block chain db.
|
||||
|
Loading…
Reference in New Issue
Block a user