searches for streams with topic rules
This commit is contained in:
parent
52c0d849d7
commit
e6868249a9
2 changed files with 21 additions and 6 deletions
|
|
@ -65,11 +65,14 @@ export default {
|
|||
return new Promise(resolve => {
|
||||
api.zulip.init().then((client) => {
|
||||
this.zulipClient = client;
|
||||
api.zulip.getStreams(client).then((result) => {
|
||||
console.log(result.streams)
|
||||
api.zulip.getStreams(client).then(async (streams) => {
|
||||
for (let stream of streams) {
|
||||
stream.topics = await api.zulip.getTopics(client, stream.stream_id)
|
||||
}
|
||||
console.log(streams)
|
||||
this.$store.commit(
|
||||
"setStreams",
|
||||
result.streams.filter((s) => s.name.startsWith(this.pubStr))
|
||||
streams.filter((s) => s.topics.find(t => t.name == 'rules'))
|
||||
);
|
||||
resolve()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,7 +20,18 @@ const
|
|||
client
|
||||
.streams
|
||||
.retrieve()
|
||||
.then(result => resolve(result))
|
||||
.then(result => resolve(result.streams))
|
||||
.catch(error => reject(error))
|
||||
})
|
||||
),
|
||||
|
||||
getTopics = (client, stream) => ( new
|
||||
Promise((resolve, reject) => {
|
||||
client
|
||||
.streams
|
||||
.topics
|
||||
.retrieve({ stream_id: stream })
|
||||
.then(result => resolve(result.topics))
|
||||
.catch(error => reject(error))
|
||||
})
|
||||
),
|
||||
|
|
@ -31,8 +42,8 @@ const
|
|||
.messages
|
||||
.retrieve(params || {
|
||||
anchor: "newest",
|
||||
// num_before: 100,
|
||||
// num_after: 0,
|
||||
num_before: 1000,
|
||||
num_after: 0,
|
||||
// apply_markdown: false,
|
||||
narrow: [
|
||||
{ operator: "stream", operand: stream },
|
||||
|
|
@ -115,6 +126,7 @@ export default {
|
|||
init,
|
||||
config,
|
||||
getStreams,
|
||||
getTopics,
|
||||
getMsgs,
|
||||
getAllMsgs,
|
||||
listen,
|
||||
|
|
|
|||
Loading…
Reference in a new issue