diff --git a/apps/issues.json b/apps/issues.json index 104906de..b3ecbdaa 100644 --- a/apps/issues.json +++ b/apps/issues.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦟", - "previous": "&TegdzvFE+im94shygaHkgDYSaSrwY2h0OKUXSRPBQDM=.sha256" + "previous": "&cUqvSDUls3jn0haD85LPFAGdkc8wFuy347TtATNcJgg=.sha256" } diff --git a/apps/issues/app.js b/apps/issues/app.js index 2b048e77..77fafa11 100644 --- a/apps/issues/app.js +++ b/apps/issues/app.js @@ -85,6 +85,9 @@ tfrpc.register(async function store_message(message) { tfrpc.register(function apps() { return core.apps(); }); +tfrpc.register(function getActiveIdentity() { + return ssb.getActiveIdentity(); +}); tfrpc.register(async function try_decrypt(id, content) { return await ssb.privateMessageDecrypt(id, content); }); diff --git a/apps/issues/script.js b/apps/issues/script.js index cdb37b91..b7ffc0bc 100644 --- a/apps/issues/script.js +++ b/apps/issues/script.js @@ -4,48 +4,6 @@ import * as tfutils from './tf-utils.js'; const k_project = '%Hr+4xEVtjplidSKBlRWi4Aw/0Tfw7B+1OR9BzlDKmOI=.sha256'; -class TfIdPickerElement extends LitElement { - static get properties() { - return { - ids: {type: Array}, - selected: {type: String}, - }; - } - - constructor() { - super(); - this.load(); - } - - async load() { - this.selected = await tfrpc.rpc.localStorageGet('whoami'); - this.ids = (await tfrpc.rpc.getIdentities()) || []; - } - - changed(event) { - this.selected = event.srcElement.value; - tfrpc.rpc.localStorageSet('whoami', this.selected); - } - - render() { - if (this.ids) { - return html` - - `; - } else { - return html`
Loading...
`; - } - } -} -customElements.define('tf-id-picker', TfIdPickerElement); - class TfComposeElement extends LitElement { static get properties() { return { @@ -105,10 +63,10 @@ class TfIssuesAppElement extends LitElement { let issues = {}; let messages = await tfrpc.rpc.query( ` - WITH issues AS (SELECT messages.* FROM messages_refs JOIN messages ON + WITH issues AS (SELECT messages.id, json(messages.content) AS content, messages.author, messages.timestamp FROM messages_refs JOIN messages ON messages.id = messages_refs.message WHERE messages_refs.ref = ? AND json_extract(messages.content, '$.type') = 'issue'), - edits AS (SELECT messages.* FROM issues JOIN messages_refs ON + edits AS (SELECT messages.id, json(messages.content) AS content, messages.author, messages.timestamp FROM issues JOIN messages_refs ON issues.id = messages_refs.ref JOIN messages ON messages.id = messages_refs.message WHERE json_extract(messages.content, '$.type') IN ('issue-edit', 'post')) @@ -206,7 +164,7 @@ class TfIssuesAppElement extends LitElement { if ( confirm(`Are you sure you want to ${open ? 'open' : 'close'} this issue?`) ) { - let whoami = this.shadowRoot.getElementById('picker').selected; + let whoami = await tfrpc.rpc.getActiveIdentity(); await tfrpc.rpc.appendMessage(whoami, { type: 'issue-edit', issues: [ @@ -221,7 +179,7 @@ class TfIssuesAppElement extends LitElement { } async create_issue(event) { - let whoami = this.shadowRoot.getElementById('picker').selected; + let whoami = await tfrpc.rpc.getActiveIdentity(); await tfrpc.rpc.appendMessage(whoami, { type: 'issue', project: k_project, @@ -231,7 +189,7 @@ class TfIssuesAppElement extends LitElement { } async reply_to_issue(event) { - let whoami = this.shadowRoot.getElementById('picker').selected; + let whoami = await tfrpc.rpc.getActiveIdentity(); await tfrpc.rpc.appendMessage(whoami, { type: 'post', text: event.detail.value, @@ -251,7 +209,6 @@ class TfIssuesAppElement extends LitElement { render() { let header = html`

Tilde Friends Issues

- `; if (this.selected) { return html` diff --git a/core/client.js b/core/client.js index e8061e51..f950fa90 100644 --- a/core/client.js +++ b/core/client.js @@ -160,7 +160,7 @@ class TfNavigationElement extends LitElement { style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 100%" > ${this.identities.map( - (x) => html`` + (x) => html`` )} `;