Lint cleanup.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4250 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-03-29 22:02:12 +00:00
parent 71de897419
commit e86b9dae48
10 changed files with 28 additions and 27 deletions

View File

@ -32,8 +32,8 @@ class TfElement extends LitElement {
this.following = []; this.following = [];
this.users = {}; this.users = {};
this.loaded = false; this.loaded = false;
tfrpc.rpc.getBroadcasts().then(b => { self.broadcasts = b || [] }); tfrpc.rpc.getBroadcasts().then(b => { self.broadcasts = b || []; });
tfrpc.rpc.getConnections().then(c => { self.connections = c || [] }); tfrpc.rpc.getConnections().then(c => { self.connections = c || []; });
tfrpc.rpc.getHash().then(hash => self.set_hash(hash)); tfrpc.rpc.getHash().then(hash => self.set_hash(hash));
tfrpc.register(function hashChanged(hash) { tfrpc.register(function hashChanged(hash) {
self.set_hash(hash); self.set_hash(hash);

View File

@ -13,7 +13,7 @@ class TfComposeElement extends LitElement {
branch: {type: String}, branch: {type: String},
apps: {type: Object}, apps: {type: Object},
drafts: {type: Object}, drafts: {type: Object},
} };
} }
static styles = styles; static styles = styles;
@ -56,7 +56,7 @@ class TfComposeElement extends LitElement {
if (!draft.mentions[link]) { if (!draft.mentions[link]) {
draft.mentions[link] = { draft.mentions[link] = {
link: link, link: link,
} };
} }
draft.mentions[link].name = name.startsWith('@') ? name.substring(1) : name; draft.mentions[link].name = name.startsWith('@') ? name.substring(1) : name;
updated = true; updated = true;
@ -111,7 +111,7 @@ class TfComposeElement extends LitElement {
let data_url = canvas.toDataURL(mime_type); let data_url = canvas.toDataURL(mime_type);
let result = atob(data_url.split(',')[1]).split('').map(x => x.charCodeAt(0)); let result = atob(data_url.split(',')[1]).split('').map(x => x.charCodeAt(0));
resolve(result); resolve(result);
} };
img.onerror = function(event) { img.onerror = function(event) {
reject(new Error('Failed to load image.')); reject(new Error('Failed to load image.'));
}; };
@ -283,11 +283,11 @@ class TfComposeElement extends LitElement {
}; };
} }
} }
let draft = this.get_draft(); let draft = self.get_draft();
draft.mentions = Object.assign(draft.mentions || {}, mentions); draft.mentions = Object.assign(draft.mentions || {}, mentions);
this.requestUpdate(); self.requestUpdate();
this.notify(draft); self.notify(draft);
this.apps = null; self.apps = null;
} }
if (this.apps) { if (this.apps) {
@ -304,13 +304,14 @@ class TfComposeElement extends LitElement {
} }
render_attach_app_button() { render_attach_app_button() {
let self = this;
async function attach_app() { async function attach_app() {
this.apps = await tfrpc.rpc.apps(); self.apps = await tfrpc.rpc.apps();
} }
if (!this.apps) { if (!this.apps) {
return html`<input type="button" value="Attach App" @click=${attach_app}></input>` return html`<input type="button" value="Attach App" @click=${attach_app}></input>`;
} else { } else {
return html`<input type="button" value="Discard App" @click=${() => this.apps = null}></input>` return html`<input type="button" value="Discard App" @click=${() => this.apps = null}></input>`;
} }
} }

View File

@ -9,7 +9,7 @@ class TfIdentityPickerElement extends LitElement {
return { return {
ids: {type: Array}, ids: {type: Array},
selected: {type: String}, selected: {type: String},
} };
} }
constructor() { constructor() {

View File

@ -14,7 +14,7 @@ class TfMessageElement extends LitElement {
raw: {type: Boolean}, raw: {type: Boolean},
blog_data: {type: String}, blog_data: {type: String},
expanded: {type: Object}, expanded: {type: Object},
} };
} }
static styles = styles; static styles = styles;
@ -69,8 +69,8 @@ class TfMessageElement extends LitElement {
hash: this.message?.hash, hash: this.message?.hash,
content: this.message?.content, content: this.message?.content,
signature: this.message?.signature, signature: this.message?.signature,
} };
return html`<div style="white-space: pre-wrap">${JSON.stringify(raw, null, 2)}</div>` return html`<div style="white-space: pre-wrap">${JSON.stringify(raw, null, 2)}</div>`;
} }
vote(emoji) { vote(emoji) {
@ -229,7 +229,7 @@ class TfMessageElement extends LitElement {
${self.raw ? self.render_raw() : inner} ${self.raw ? self.render_raw() : inner}
${self.render_votes()} ${self.render_votes()}
</div> </div>
` `;
} }
if (this.message?.type === 'contact_group') { if (this.message?.type === 'contact_group') {
return html` return html`
@ -265,7 +265,7 @@ class TfMessageElement extends LitElement {
<div style="flex: 1 0 50%; overflow-wrap: anywhere"> <div style="flex: 1 0 50%; overflow-wrap: anywhere">
<div>${unsafeHTML(tfutils.markdown(content.description))}</div> <div>${unsafeHTML(tfutils.markdown(content.description))}</div>
</div> </div>
` `;
} }
let update = content.about == this.message.author ? let update = content.about == this.message.author ?
html`<div style="font-weight: bold">Updated profile.</div>` : html`<div style="font-weight: bold">Updated profile.</div>` :

View File

@ -11,7 +11,7 @@ class TfNewsElement extends LitElement {
following: {type: Array}, following: {type: Array},
drafts: {type: Object}, drafts: {type: Object},
expanded: {type: Object}, expanded: {type: Object},
} };
} }
static styles = styles; static styles = styles;

View File

@ -11,7 +11,7 @@ class TfProfileElement extends LitElement {
id: {type: String}, id: {type: String},
users: {type: Object}, users: {type: Object},
size: {type: Number}, size: {type: Number},
} };
} }
static styles = styles; static styles = styles;
@ -33,7 +33,7 @@ class TfProfileElement extends LitElement {
contact: this.id, contact: this.id,
}, change)).catch(function(error) { }, change)).catch(function(error) {
alert(error?.message); alert(error?.message);
}) });
} }
follow() { follow() {

View File

@ -9,7 +9,7 @@ class TfTabConnectionsElement extends LitElement {
connections: {type: Array}, connections: {type: Array},
stored_connections: {type: Array}, stored_connections: {type: Array},
users: {type: Object}, users: {type: Object},
} };
} }
constructor() { constructor() {
@ -71,7 +71,7 @@ class TfTabConnectionsElement extends LitElement {
<tf-user id=${connection.pubkey} .users=${this.users}></tf-user> <tf-user id=${connection.pubkey} .users=${this.users}></tf-user>
${this.render_connection_summary(connection)} ${this.render_connection_summary(connection)}
</li> </li>
` `;
} }
async forget_stored_connection(connection) { async forget_stored_connection(connection) {

View File

@ -12,7 +12,7 @@ class TfTabNewsFeedElement extends LitElement {
messages: {type: Array}, messages: {type: Array},
drafts: {type: Object}, drafts: {type: Object},
expanded: {type: Object}, expanded: {type: Object},
} };
} }
static styles = styles; static styles = styles;
@ -120,7 +120,7 @@ class TfTabNewsElement extends LitElement {
following: {type: Array}, following: {type: Array},
drafts: {type: Object}, drafts: {type: Object},
expanded: {type: Object}, expanded: {type: Object},
} };
} }
static styles = styles; static styles = styles;

View File

@ -9,7 +9,7 @@ class TfTabSearchElement extends LitElement {
users: {type: Object}, users: {type: Object},
following: {type: Array}, following: {type: Array},
query: {type: String}, query: {type: String},
} };
} }
static styles = styles; static styles = styles;

View File

@ -7,7 +7,7 @@ class TfUserElement extends LitElement {
return { return {
id: {type: String}, id: {type: String},
users: {type: Object}, users: {type: Object},
} };
} }
static styles = styles; static styles = styles;