Make privateness of wiki pages sticky.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4657 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-12-04 17:50:13 +00:00
parent 5511530926
commit b13b111614
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "📝", "emoji": "📝",
"previous": "&C6kk2ozHZKVTtxbEqLOD/xbsCjosnLb6HJWZuPZrtS8=.sha256" "previous": "&LQxzXMctRw4GkxIfsqFFSWhn+8xclOinS/O2q8n1Vfc=.sha256"
} }

View File

@ -66,7 +66,7 @@ class TfWikiDocElement extends LitElement {
async append_message(draft) { async append_message(draft) {
let blob = this.blob; let blob = this.blob;
if (draft) { if (draft || this.value?.private) {
blob = await tfrpc.rpc.encrypt(this.whoami, this.value.editors, blob); blob = await tfrpc.rpc.encrypt(this.whoami, this.value.editors, blob);
} }
let id = await tfrpc.rpc.store_blob(blob); let id = await tfrpc.rpc.store_blob(blob);
@ -76,6 +76,7 @@ class TfWikiDocElement extends LitElement {
parent: this.value.parent, parent: this.value.parent,
blob: id, blob: id,
mentions: this.blob.match(/(&.{44}.sha256)/g)?.map(x => ({link: x})), mentions: this.blob.match(/(&.{44}.sha256)/g)?.map(x => ({link: x})),
private: this.value?.private,
}; };
if (draft) { if (draft) {
message.recps = this.value.editors; message.recps = this.value.editors;
@ -176,11 +177,12 @@ class TfWikiDocElement extends LitElement {
<button ?disabled=${this.blob == this.blob_original} @click=${this.on_save_draft}>Save Draft</button> <button ?disabled=${this.blob == this.blob_original} @click=${this.on_save_draft}>Save Draft</button>
<button ?disabled=${this.blob == this.blob_original && !this.value?.draft} @click=${this.on_publish}>Publish</button> <button ?disabled=${this.blob == this.blob_original && !this.value?.draft} @click=${this.on_publish}>Publish</button>
<button ?disabled=${!this.is_editing} @click=${this.on_discard}>Discard</button> <button ?disabled=${!this.is_editing} @click=${this.on_discard}>Discard</button>
<button ?disabled=${!this.is_editing} @click=${() => self.value = Object.assign({}, self.value, {private: !self.value.private})}>${this.value?.private ? 'Make Public' : 'Make Private'}</button>
</div> </div>
<div style="display: flex; flex-direction: row"> <div style="display: flex; flex-direction: row">
<textarea <textarea
?hidden=${!this.is_editing} ?hidden=${!this.is_editing}
style="flex: 1 1; min-height: 10em" style="flex: 1 1; min-height: 10em; ${this.value?.private ? 'border: 4px solid #800' : ''}"
@input=${this.on_edit} @input=${this.on_edit}
@paste=${this.paste} @paste=${this.paste}
.value=${this.blob ?? ''}></textarea> .value=${this.blob ?? ''}></textarea>