A few minor things. Fixed missing fields from app messages. Fixed some missing messages. Removed unnecessary asyncs.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3637 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
7012418b13
commit
92c06b34a9
@ -1 +1 @@
|
||||
{"type":"tildefriends-app","files":{"app.js":"&WiH+BcLge0Imgpcfo/lecF92raEkf2cLyxr+GQKM5DU=.sha256","index.html":"&z528csPu5+I+634DKxY3EBOQYAAVt1hLOQiWj+gW+qM=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256"}}
|
||||
{"type":"tildefriends-app","files":{"app.js":"&QC3jbGKlu7N1D7w6L64MUuT0EWf0MSew1gEg4LbaFcM=.sha256","index.html":"&eqLI+5Abbs4OEjIO7neOQFjhm/iknp6gi96RD2VTAR0=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256"}}
|
@ -5,7 +5,7 @@ const k_votes_max = 100;
|
||||
|
||||
async function following(db, id) {
|
||||
var o = await db.get(id + ":following");
|
||||
const k_version = 4;
|
||||
const k_version = 5;
|
||||
var f = o ? JSON.parse(o) : o;
|
||||
if (!f || f.version != k_version) {
|
||||
f = {users: [], sequence: 0, version: k_version};
|
||||
@ -24,7 +24,7 @@ async function following(db, id) {
|
||||
"UNION SELECT MAX(sequence) AS sequence, NULL, NULL FROM messages WHERE author = ?1 "+
|
||||
"ORDER BY sequence",
|
||||
[id, f.sequence],
|
||||
async function(row) {
|
||||
function(row) {
|
||||
if (row.following) {
|
||||
f.users.add(row.contact);
|
||||
} else {
|
||||
@ -53,7 +53,7 @@ async function followingDeep(db, seed_ids, depth) {
|
||||
|
||||
async function followers(db, id) {
|
||||
var o = await db.get(id + ":followers");
|
||||
const k_version = 2;
|
||||
const k_version = 3;
|
||||
var f = o ? JSON.parse(o) : o;
|
||||
if (!f || f.version != k_version) {
|
||||
f = {users: [], rowid: 0, version: k_version};
|
||||
@ -72,7 +72,7 @@ async function followers(db, id) {
|
||||
"UNION SELECT MAX(rowid) as rowid, NULL, NULL FROM messages "+
|
||||
"ORDER BY rowid",
|
||||
[f.rowid, id],
|
||||
async function(row) {
|
||||
function(row) {
|
||||
if (row.following) {
|
||||
f.users.add(row.contact);
|
||||
} else {
|
||||
@ -101,7 +101,7 @@ async function sendUser(db, id) {
|
||||
|
||||
async function pubsByUser(db, id) {
|
||||
var o = await db.get(id + ":pubs");
|
||||
const k_version = 2;
|
||||
const k_version = 3;
|
||||
var f = o ? JSON.parse(o) : o;
|
||||
if (!f || f.version != k_version) {
|
||||
f = {pubs: [], sequence: 0, version: k_version};
|
||||
@ -121,7 +121,7 @@ async function pubsByUser(db, id) {
|
||||
"UNION SELECT MAX(sequence) as sequence, NULL, NULL, NULL FROM messages WHERE author = ?2 "+
|
||||
"ORDER BY sequence",
|
||||
[f.sequence, id],
|
||||
async function(row) {
|
||||
function(row) {
|
||||
f.sequence = row.sequence;
|
||||
if (row.host) {
|
||||
row = {host: row.host, port: row.port, key: row.key};
|
||||
@ -237,7 +237,7 @@ async function getRecentPostIds(db, id, ids, limit) {
|
||||
|
||||
async function getVotes(db, id) {
|
||||
var o = await db.get(id + ":votes");
|
||||
const k_version = 2;
|
||||
const k_version = 3;
|
||||
var votes = [];
|
||||
var f = o ? JSON.parse(o) : o;
|
||||
if (!f || f.version != k_version) {
|
||||
@ -259,7 +259,7 @@ async function getVotes(db, id) {
|
||||
"UNION SELECT MAX(rowid) as rowid, NULL, NULL AS id, NULL, NULL, NULL FROM messages "+
|
||||
"ORDER BY rowid DESC LIMIT ?",
|
||||
[f.rowid, id, k_votes_max],
|
||||
async function(row) {
|
||||
function(row) {
|
||||
if (row.id) {
|
||||
votes.push(row);
|
||||
} else {
|
||||
@ -363,6 +363,7 @@ core.register('message', async function(m) {
|
||||
app = JSON.parse(utf8Decode(app));
|
||||
app.type = 'tildefriends-app';
|
||||
app.name = m.message.share_app.name;
|
||||
app.text = m.message.share_app.text;
|
||||
await ssb.appendMessage(app);
|
||||
} else if (m.message.user) {
|
||||
await sendUser(await database("ssb"), m.message.user);
|
||||
|
@ -183,6 +183,10 @@
|
||||
<div v-html="this.markdown(content_json.text)"></div>
|
||||
<img v-for="mention in content_json.mentions" v-if="mention.link && typeof(mention.link) == 'string' && mention.link.startsWith('&')" :src="'/' + mention.link + '/view'"></img>
|
||||
</div>
|
||||
<div v-else-if="content_json && content_json.type == 'tildefriends-app'">
|
||||
<div v-html="this.markdown(content_json.text)"></div>
|
||||
<md-button target="_top" :href="'/' + message.id + '/'">{{content_json.name || 'tildefriends-app'}}</md-button>
|
||||
</div>
|
||||
<div v-else-if="content_json && content_json.type == 'contact'"><tf-user :id="message.author"></tf-user> {{content_json.following ? '==>' : '=/=>'}} <tf-user :id="content_json.contact"></tf-user></div>
|
||||
<div v-else>{{message.content}}</div>
|
||||
</div>
|
||||
@ -203,6 +207,7 @@
|
||||
if (g_data.share_app) {
|
||||
window.parent.postMessage({share_app: {
|
||||
app: g_data.apps[g_data.share_app],
|
||||
name: g_data.share_app,
|
||||
text: document.getElementById('post_text').value,
|
||||
}}, '*');
|
||||
} else {
|
||||
@ -296,7 +301,7 @@
|
||||
<md-button class="md-raised md-primary" v-on:click="post_message()">Submit Post</md-button>
|
||||
</md-card-actions>
|
||||
</md-card>
|
||||
<tf-message v-for="message in messages" v-if="!content_json(message).root" v-bind:message="message" v-bind:messages="messages" v-bind:key="message.id"></tf-message>
|
||||
<tf-message v-for="message in messages" v-if="!content_json(message).root || !messages.some(m => m.id == content_json(message).root)" v-bind:message="message" v-bind:messages="messages" v-bind:key="message.id"></tf-message>
|
||||
</md-app-content>
|
||||
</md-app>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user