added authors
This commit is contained in:
parent
2bb3b0d4f9
commit
f0da6c6bac
4 changed files with 65 additions and 27 deletions
|
|
@ -76,9 +76,9 @@ export default {
|
||||||
|
|
||||||
getStreams() {
|
getStreams() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
api.zulip.init().then((client) => {
|
api.zulip.init().then(async client => {
|
||||||
this.zulipClient = client;
|
this.zulipClient = client;
|
||||||
api.zulip.getStreams(client).then(streams => {
|
const streams = await api.zulip.getStreams(client)
|
||||||
for (const stream of streams) {
|
for (const stream of streams) {
|
||||||
stream.slug = stream.name.replaceAll(' ', '_')
|
stream.slug = stream.name.replaceAll(' ', '_')
|
||||||
}
|
}
|
||||||
|
|
@ -89,9 +89,8 @@ export default {
|
||||||
s.description.includes('_PUB_')
|
s.description.includes('_PUB_')
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
resolve()
|
|
||||||
});
|
|
||||||
api.zulip.listen(this.zulipClient, this.eventHandler);
|
api.zulip.listen(this.zulipClient, this.eventHandler);
|
||||||
|
resolve()
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,16 @@ const
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
|
getUsers = client => ( new
|
||||||
|
Promise((resolve, reject) => {
|
||||||
|
client
|
||||||
|
.users
|
||||||
|
.retrieve()
|
||||||
|
.then(result => resolve(result.members))
|
||||||
|
.catch(error => reject(error))
|
||||||
|
})
|
||||||
|
),
|
||||||
|
|
||||||
getTopics = (client, stream) => ( new
|
getTopics = (client, stream) => ( new
|
||||||
Promise((resolve, reject) => {
|
Promise((resolve, reject) => {
|
||||||
client
|
client
|
||||||
|
|
@ -126,6 +136,7 @@ export default {
|
||||||
init,
|
init,
|
||||||
config,
|
config,
|
||||||
getStreams,
|
getStreams,
|
||||||
|
getUsers,
|
||||||
getTopics,
|
getTopics,
|
||||||
getMsgs,
|
getMsgs,
|
||||||
getAllMsgs,
|
getAllMsgs,
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ export default {
|
||||||
// return emojiConv.replace_colons(":" + r.emoji_name + ":");
|
// return emojiConv.replace_colons(":" + r.emoji_name + ":");
|
||||||
// });
|
// });
|
||||||
// return [];
|
// return [];
|
||||||
|
// console.log(this.message)
|
||||||
return this.message.reactions.map((r) =>
|
return this.message.reactions.map((r) =>
|
||||||
emojiConv.replace_colons(":" + r.emoji_name + ":")
|
emojiConv.replace_colons(":" + r.emoji_name + ":")
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
:source="description"
|
:source="description"
|
||||||
v-bind="$mdOpts"
|
v-bind="$mdOpts"
|
||||||
>
|
>
|
||||||
|
|
||||||
</vue3-markdown-it>
|
</vue3-markdown-it>
|
||||||
<ul class="index">
|
<ul class="index">
|
||||||
<li v-for="topic in sortedTopics" :key="topic.title">
|
<li v-for="topic in sortedTopics" :key="topic.title">
|
||||||
|
|
@ -18,7 +17,18 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- <div style="float: none"><div style="page-break-after: always"></div></div> -->
|
<p class="authors">
|
||||||
|
<span
|
||||||
|
class="author"
|
||||||
|
v-for="author in authors"
|
||||||
|
:key="author"
|
||||||
|
>
|
||||||
|
<span>{{ author }}</span>
|
||||||
|
<span v-if="isLast(author, authors)">.</span>
|
||||||
|
<span v-else-if="isBeforeLast(author, authors)"> and </span>
|
||||||
|
<span v-else>, </span>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
<Chapter
|
<Chapter
|
||||||
v-for="topic in sortedTopics"
|
v-for="topic in sortedTopics"
|
||||||
:key="topic.title"
|
:key="topic.title"
|
||||||
|
|
@ -43,8 +53,12 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["currentStream", "streams"]),
|
...mapState(["currentStream", "streams"]),
|
||||||
...mapGetters(["sortedTopics"]),
|
...mapGetters(["sortedTopics"]),
|
||||||
title() {
|
|
||||||
|
foundStream() {
|
||||||
return this.streams.find((s) => s.name == this.currentStream.name)
|
return this.streams.find((s) => s.name == this.currentStream.name)
|
||||||
|
},
|
||||||
|
title() {
|
||||||
|
return this.foundStream
|
||||||
? this.currentStream.name
|
? this.currentStream.name
|
||||||
: this.$route.path == '/'
|
: this.$route.path == '/'
|
||||||
? "<= pick a stream"
|
? "<= pick a stream"
|
||||||
|
|
@ -52,9 +66,22 @@ export default {
|
||||||
},
|
},
|
||||||
description() {
|
description() {
|
||||||
return this.title &&
|
return this.title &&
|
||||||
this.streams.find((s) => s.name == this.currentStream.name)
|
this.foundStream &&
|
||||||
.description.replace('_PUB_', '')
|
this.foundStream.description.replace('_PUB_', '')
|
||||||
},
|
},
|
||||||
|
authors() {
|
||||||
|
return [
|
||||||
|
...new Set(
|
||||||
|
this.title &&
|
||||||
|
this.foundStream &&
|
||||||
|
this.sortedTopics
|
||||||
|
.map(t => t.messages)
|
||||||
|
.flat()
|
||||||
|
.map(m => m.sender_full_name)
|
||||||
|
),
|
||||||
|
...[ 'Pub Bot' ]
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toValidID(string) {
|
toValidID(string) {
|
||||||
|
|
@ -67,18 +94,18 @@ export default {
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
isLast: (item, array) => (
|
||||||
|
array.indexOf(item) === array.length - 1
|
||||||
|
),
|
||||||
|
isBeforeLast: (item, array) => (
|
||||||
|
array.indexOf(item) === array.length - 2
|
||||||
|
),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@media print {
|
.authors {
|
||||||
.title {
|
|
||||||
/* display: none; */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.index {
|
|
||||||
page-break-after: always;
|
page-break-after: always;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in a new issue