Stay in chan during search by searching on /chat-:id/search
This commit is contained in:
parent
1b13905195
commit
ddff3ac162
@ -131,8 +131,7 @@ export default {
|
|||||||
.push({
|
.push({
|
||||||
name: "SearchResults",
|
name: "SearchResults",
|
||||||
params: {
|
params: {
|
||||||
uuid: this.network.uuid,
|
id: this.channel.id,
|
||||||
target: this.channel.name,
|
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
q: this.searchInput,
|
q: this.searchInput,
|
||||||
|
@ -17,8 +17,7 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<SidebarToggle />
|
<SidebarToggle />
|
||||||
<span class="title"
|
<span class="title"
|
||||||
>Searching in
|
>Searching in <span class="channel-name">{{ channel.name }}</span> for</span
|
||||||
<span class="channel-name">{{ $route.params.target }}</span> for</span
|
|
||||||
>
|
>
|
||||||
<span class="topic">{{ $route.query.q }}</span>
|
<span class="topic">{{ $route.query.q }}</span>
|
||||||
<MessageSearchForm :network="network" :channel="channel" />
|
<MessageSearchForm :network="network" :channel="channel" />
|
||||||
@ -122,15 +121,8 @@ export default {
|
|||||||
return this.search.results.slice().reverse();
|
return this.search.results.slice().reverse();
|
||||||
},
|
},
|
||||||
chan() {
|
chan() {
|
||||||
if (!this.search) {
|
const chanId = parseInt(this.$route.params.id, 10);
|
||||||
return;
|
return this.$store.getters.findChannel(chanId);
|
||||||
}
|
|
||||||
|
|
||||||
const chan = this.$store.getters.findChannelOnNetwork(
|
|
||||||
this.search.networkUuid,
|
|
||||||
this.search.target
|
|
||||||
);
|
|
||||||
return chan;
|
|
||||||
},
|
},
|
||||||
network() {
|
network() {
|
||||||
if (!this.chan) {
|
if (!this.chan) {
|
||||||
@ -148,14 +140,13 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"$route.params.uuid"() {
|
"$route.params.id"() {
|
||||||
this.doSearch();
|
|
||||||
},
|
|
||||||
"$route.params.target"() {
|
|
||||||
this.doSearch();
|
this.doSearch();
|
||||||
|
this.setActiveChannel();
|
||||||
},
|
},
|
||||||
"$route.query.q"() {
|
"$route.query.q"() {
|
||||||
this.doSearch();
|
this.doSearch();
|
||||||
|
this.setActiveChannel();
|
||||||
},
|
},
|
||||||
messages() {
|
messages() {
|
||||||
this.moreResultsAvailable = this.messages.length && !(this.messages.length % 100);
|
this.moreResultsAvailable = this.messages.length && !(this.messages.length % 100);
|
||||||
@ -170,11 +161,9 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chan() {
|
|
||||||
this.setActiveChannel();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.setActiveChannel();
|
||||||
this.doSearch();
|
this.doSearch();
|
||||||
this.$root.$on("re-search", this.doSearch); // Enable MessageSearchForm to search for the same query again
|
this.$root.$on("re-search", this.doSearch); // Enable MessageSearchForm to search for the same query again
|
||||||
},
|
},
|
||||||
@ -203,8 +192,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
socket.emit("search", {
|
socket.emit("search", {
|
||||||
networkUuid: this.$route.params.uuid,
|
networkUuid: this.network.uuid,
|
||||||
channelName: this.$route.params.target,
|
channelName: this.channel.name,
|
||||||
searchTerm: this.$route.query.q,
|
searchTerm: this.$route.query.q,
|
||||||
offset: this.offset,
|
offset: this.offset,
|
||||||
});
|
});
|
||||||
@ -217,8 +206,8 @@ export default {
|
|||||||
this.oldChatHeight = this.$refs.chat.scrollHeight;
|
this.oldChatHeight = this.$refs.chat.scrollHeight;
|
||||||
|
|
||||||
socket.emit("search", {
|
socket.emit("search", {
|
||||||
networkUuid: this.$route.params.uuid,
|
networkUuid: this.network.uuid,
|
||||||
channelName: this.$route.params.target,
|
channelName: this.channel.name,
|
||||||
searchTerm: this.$route.query.q,
|
searchTerm: this.$route.query.q,
|
||||||
offset: this.offset + 1,
|
offset: this.offset + 1,
|
||||||
});
|
});
|
||||||
|
@ -66,7 +66,7 @@ const router = new VueRouter({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "SearchResults",
|
name: "SearchResults",
|
||||||
path: "/search/:uuid/:target",
|
path: "/chan-:id/search",
|
||||||
component: SearchResults,
|
component: SearchResults,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user