Skip to content

Commit

Permalink
Add custom title to new shared conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
mayfield committed Apr 26, 2019
1 parent 9cb3f50 commit 8ebac9e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 14 additions & 4 deletions app/views/new_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@
const messagesSent = await F.counters.getAgeWeightedTotal(x, 'messages-sent');
return [x, (mentions * 10) + messagesSent];
})));
const prioUsers = Array.from(users);
prioUsers.sort((a, b) => ranks[a] - ranks[b]);
const prioUsers = users.filter(x => x.id !== F.currentUser.id);
prioUsers.sort((a, b) => ranks.get(b) - ranks.get(a));
prioUsers.length = Math.min(5, prioUsers.length);
if (prioUsers.length) {
html.push(`<div class="f-priority-header">Recent / Frequent...</div>`);
Expand Down Expand Up @@ -360,9 +360,19 @@

onShareClick: async function() {
this.hidePanel();
const thread = await F.foundation.allThreads.make(F.currentUser.getTagSlug());
const label = (await mnemonic.Mnemonic.factory()).phrase.split(' ').slice(0, 2).join('-');
const thread = await F.foundation.allThreads.make(F.currentUser.getTagSlug(), {
title: `Shared Conversation (${label})`
});
F.mainView.openThread(thread);
await F.util.shareThreadLink(thread);
const url = await F.util.shareThreadLink(thread);
await thread.createMessage({
type: 'clientOnly',
safe_html: [
`Share this URL to invite others to this thread...`,
`<pre>${url}</pre>`
].join('')
});
},

startThread: async function(expression) {
Expand Down
4 changes: 2 additions & 2 deletions html/main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
<i class="f-complete icon arrow right grey off"
data-icon="arrow right"
title="Select recipients and then click here."></i>
<i class="f-share icon share"
title="Create new shared conversation"></i>
<i class="f-cancel icon close red" title="Cancel"></i>
<i class="f-share icon share blue"
title="Create new shared conversation"></i>
</div>

<div class="f-nav-holder">
Expand Down

0 comments on commit 8ebac9e

Please sign in to comment.