Parcourir la source

Show different message for reply button depending on whether logged in or not

sbkwgh il y a 7 ans
Parent
commit
e80196ec2f
1 fichiers modifiés avec 17 ajouts et 5 suppressions
  1. 17 5
      frontend/src/components/routes/Thread.vue

+ 17 - 5
frontend/src/components/routes/Thread.vue

@@ -48,9 +48,9 @@
 			<button
 				class='button button--thin_text'
 				@click='replyThread'
-				v-if='$store.state.username && !$store.state.thread.locked'
+				v-if='!$store.state.thread.locked'
 			>
-					Reply to thread
+				{{replyThreadButton}}
 			</button>
 			<post-scrubber
 				:posts='$store.state.thread.totalPostsCount'
@@ -189,7 +189,14 @@
 					this.$store.commit('setThreadEditorValue', val)
 				}
 			},
-			editorState () { return this.$store.state.thread.editor.show }
+			editorState () { return this.$store.state.thread.editor.show },
+			replyThreadButton () {
+				if(this.$store.state.username) {
+					return 'Reply to thread';
+				} else {
+					return 'Login to reply'
+				}
+			}
 		},
 		methods: {
 			deleteThread () {
@@ -225,8 +232,13 @@
 				});
 			},
 			replyThread () {
-				this.clearReply();
-				this.showEditor();
+				if(this.$store.state.username) {
+					this.clearReply();
+					this.showEditor();
+				} else {
+					this.$store.commit('setAccountTabs', 1);
+					this.$store.commit('setAccountModalState', true);
+				}
 			},
 			replyUser (id, username) {
 				this.$store.commit({