Fixed all notification bugs, ready to be uploaded

This commit is contained in:
supertiger1234 2019-06-03 13:08:06 +01:00
parent 7365685802
commit f66f3e9cb9
6 changed files with 58 additions and 11 deletions

View file

@ -192,8 +192,11 @@ export default {
clearInterval(this.postTimerID); clearInterval(this.postTimerID);
this.postTimerID = null; this.postTimerID = null;
}else { }else {
await typingService.post(this.selectedChannelID); if (this.selectedChannelID)
this.postTimer() await typingService.post(this.selectedChannelID);
if (this.postTimerID)
this.postTimer()
} }
}, 2000) }, 2000)

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="channel"> <div :class="{channel: true, notifyAnimation: hasNotifications}">
<i class="material-icons">storage</i> <i class="material-icons">storage</i>
<div class="channel-name">{{ChannelData.name}}</div> <div class="channel-name">{{ChannelData.name}}</div>
</div> </div>
@ -7,12 +7,45 @@
<script> <script>
export default { export default {
props: ["ChannelData"] props: ["ChannelData"],
computed: {
hasNotifications() {
const notifications = this.$store.getters.notifications;
const find = notifications.find(n => n.channelID === this.ChannelData.channelID)
return find
}
}
}; };
</script> </script>
<style scoped> <style scoped>
.notifyAnimation{
animation: notifyAnime;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
}
@keyframes notifyAnime {
0%{
background: rgba(255, 0, 0, 0.198);
}
40%{
background: rgba(255, 0, 0, 0.411);
}
60%{
background: rgba(255, 0, 0, 0.411);
}
100%{
background: rgba(255, 0, 0, 0.198);
}
}
.channel { .channel {
display: flex; display: flex;
align-items: center; align-items: center;

View file

@ -11,12 +11,20 @@
import Spinner from "@/components/Spinner.vue"; import Spinner from "@/components/Spinner.vue";
import ChannelTemplate from "@/components/app/ServerTemplate/ChannelTemplate.vue"; import ChannelTemplate from "@/components/app/ServerTemplate/ChannelTemplate.vue";
import ServerService from "@/services/ServerService.js"; import ServerService from "@/services/ServerService.js";
import {bus} from '@/main.js'
export default { export default {
components: { ChannelTemplate, Spinner }, components: { ChannelTemplate, Spinner },
props: ["serverID"], props: ["serverID"],
methods: { methods: {
openChannel(channel) { openChannel(channel) {
const notificationExists = this.$store.getters.notifications.find(n => n.channelID === channel.channelID)
if (notificationExists && document.hasFocus()) {
this.$socket.emit('notification:dismiss', {channelID: channel.channelID});
}
bus.$emit('closeLeftMenu');
this.$store.dispatch('openChannel', channel) this.$store.dispatch('openChannel', channel)
} }
}, },

View file

@ -68,12 +68,16 @@ export default {
</script> </script>
<style scoped> <style scoped>
.direct-message-tab{
overflow: hidden;
}
.slide-left-enter-active, .slide-left-enter-active,
.slide-left-leave-active { .slide-left-leave-active {
transition: 0.5s; transition: 0.5s;
} }
.slide-left-enter, .slide-left-leave-to /* .fade-leave-active below version 2.1.8 */ { .slide-left-enter, .slide-left-leave-to /* .fade-leave-active below version 2.1.8 */ {
margin-left: -300px; transform: translateX(-300px)
} }
.slide-right-enter-active, .slide-right-enter-active,
@ -81,7 +85,7 @@ export default {
transition: 0.5s; transition: 0.5s;
} }
.slide-right-enter, .slide-right-leave-to /* .fade-leave-active below version 2.1.8 */ { .slide-right-enter, .slide-right-leave-to /* .fade-leave-active below version 2.1.8 */ {
margin-right: -300px; transform: translateX(300px)
} }

View file

@ -34,7 +34,7 @@ const actions = {
const mutations = { const mutations = {
SET_CHANNELS_IDS(state, {serverID, channelsIDs}) { SET_CHANNELS_IDS(state, {serverID, channelsIDs}) {
const previousChannels = state.channelsIDs[serverID] || [] const previousChannels = state.channelsIDs[serverID] || []
Vue.set(state.channelsIDs, serverID, [...previousChannels, ...channelsIDs]); Vue.set(state.channelsIDs, serverID, [...new Set([...previousChannels, ...channelsIDs])]);
}, },
SET_SERVERS(state, servers) { SET_SERVERS(state, servers) {

View file

@ -17,17 +17,16 @@ const config = [
version: 4.5, version: 4.5,
title: "Server bug fixes", title: "Server bug fixes",
shortTitle: "Server bug fixes", shortTitle: "Server bug fixes",
date: "27/05/2019", date: "03/06/2019",
headColor: "rgba(155, 244, 66, 0.77)", headColor: "rgba(3, 70, 115, 0.77)",
new: [ new: [
"Notifications for servers has been added." "Notifications for servers has been added."
], ],
fix: [ fix: [
"Fixed notification bug where server notification are shown in dms", "Fixed notification bug where server notification are shown in dms.",
"When switching from server to direct message tab (and vice versa), the channels should now be separated.", "When switching from server to direct message tab (and vice versa), the channels should now be separated.",
'You can now only create 30 invites per server.' 'You can now only create 30 invites per server.'
], ],
next: [""]
}, },
{ {
version: 4, version: 4,