Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Revert "[WorkInProgress] initial create mentions links" #34

Merged
merged 1 commit into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions dna/clutter/clutter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ function post(post) {
// On the DHT, puts a link on my hash to the new post
commit("post_links",{Links:[{Base:me,Link:key,Tag:"post"}]});

// MENTIONS
// detect mentions
// for each mention, write that mention as a link
var mentions = detectMentions(post.message)
for (var i = 0; i <= mentions.length; i++) {
// get the userhash for this handle
var userHash = getAgent(handle)
if (userHash) {
createMention(userHash, key)
}
}

debug("meta: "+JSON.stringify(getLinks(me,"post",{Load:true})));
debug(key);
return key; // Returns the hash key of the new post to the calling function
Expand Down Expand Up @@ -181,36 +169,11 @@ function getAgent(handle) {
}
return "";
}

function getMentions() {
var links = getLinks(getMe(), "mentioned");
// map the array of "links" into simple postHashes
// return an array of postHashes
return [];
}

// ==============================================================================
// HELPERS: unexposed functions
// ==============================================================================

function detectMentions(postString) {
var regexp = /\B\@\w\w+\b/g;
var matches = postString.match(regexp);
return matches;
// returns something like ["bob"]
}

function createMention(userHash,postHash) {
var commit_hash = commit("userMention_links",{
Links:[
{Base: userHash, Link: postHash, Tag: "mentioned"},
{Base: postHash, Link: userHash, Tag: "mentions"}
]
});
debug('create a mention');
debug(commit_hash);
return commit_hash;
}

// helper function to resolve which has will be used as "me"
function getMe() {return App.Key.Hash;}
Expand Down
9 changes: 0 additions & 9 deletions dna/dna.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
"Name": "directory_links",
"DataFormat": "links"
},
{
"Name": "userMention_links",
"DataFormat": "links"
},
{
"Name": "follow",
"DataFormat": "links"
Expand Down Expand Up @@ -134,11 +130,6 @@
"Name": "getHandles",
"CallingType": "json",
"Exposure":"public"
},
{
"Name": "getMentions",
"CallingType": "json",
"Exposure":"public"
}
]
}
Expand Down