Commit 4d1395740db1ddebaa558f2c27d29ab772e74936
Render private about messages more compactly
cel committed on 4/8/2019, 9:45:10 PMParent: 5c782b79a38d0ec6a29c019a55ef66a1b6000acf
Files changed
lib/render-msg.js | changed |
lib/render-msg.js | |||
---|---|---|---|
@@ -559,8 +559,9 @@ | |||
559 | 559 … | var knownAboutProps = { | |
560 | 560 … | channel: true, | |
561 | 561 … | type: true, | |
562 | 562 … | root: true, | |
563 … | + recps: true, | ||
563 | 564 … | branch: true, | |
564 | 565 … | about: true, | |
565 | 566 … | attendee: true, | |
566 | 567 … | about: true, | |
@@ -585,21 +586,23 @@ | |||
585 | 586 … | 'talenet-version': true, | |
586 | 587 … | } | |
587 | 588 … | ||
588 | 589 … | RenderMsg.prototype.about = function (cb) { | |
589 | - var keys = Object.keys(this.c).sort().join() | ||
590 … | + var keys = Object.keys(this.c).filter(function (k) { | ||
591 … | + return k !== 'about' && k !== 'type' && k !== 'recps' | ||
592 … | + }).sort().join() | ||
590 | 593 … | var isSelf = this.c.about === this.msg.value.author | |
591 | 594 … | ||
592 | - if (keys === 'about,name,type') { | ||
595 … | + if (keys === 'name') { | ||
593 | 596 … | return this.wrapMini([ | |
594 | 597 … | isSelf ? | |
595 | 598 … | 'self-identifies as ' : | |
596 | 599 … | ['identifies ', h('a', {href: this.toUrl(this.c.about)}, u.truncate(this.c.about, 10)), ' as '], | |
597 | 600 … | h('ins', String(this.c.name)) | |
598 | 601 … | ], cb) | |
599 | 602 … | } | |
600 | 603 … | ||
601 | - if (keys === 'about,publicWebHosting,type') { | ||
604 … | + if (keys === 'publicWebHosting') { | ||
602 | 605 … | var public = this.c.publicWebHosting && this.c.publicWebHosting !== 'false' | |
603 | 606 … | return this.wrapMini([ | |
604 | 607 … | isSelf ? | |
605 | 608 … | public ? 'is okay with being hosted publicly' | |
@@ -614,9 +617,9 @@ | |||
614 | 617 … | var done = multicb({pluck: 1, spread: true}) | |
615 | 618 … | var elCb = done() | |
616 | 619 … | ||
617 | 620 … | var isAttendingMsg = u.linkDest(this.c.attendee) === this.msg.value.author | |
618 | - && keys === 'about,attendee,type' | ||
621 … | + && keys === 'attendee' | ||
619 | 622 … | if (isAttendingMsg) { | |
620 | 623 … | var attending = !this.c.attendee.remove | |
621 | 624 … | this.wrapMini([ | |
622 | 625 … | attending ? ' is attending' : ' is not attending', ' ', |
Built with git-ssb-web