mirror of
https://github.com/ipfs/ipfs-blog.git
synced 2026-03-28 17:32:37 +01:00
fix: separate author names
This commit is contained in:
@@ -7,11 +7,17 @@
|
||||
class="flex items-center"
|
||||
>
|
||||
<span
|
||||
v-for="(piece, index) in resolvedAuthorName"
|
||||
:key="piece"
|
||||
itemprop="name"
|
||||
class="whitespace-no-wrap hover:text-blueGreen hover:underline cursor-pointer"
|
||||
@click="handleAuthorClick()"
|
||||
>{{ name }}</span
|
||||
>
|
||||
>{{ index === 0 ? '' : ',' }}
|
||||
<span
|
||||
class="whitespace-no-wrap hover:text-blueGreen hover:underline cursor-pointer"
|
||||
@click="handleAuthorClick(piece)"
|
||||
>
|
||||
{{ piece }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -25,11 +31,20 @@ export default {
|
||||
mixins: [Author],
|
||||
computed: {
|
||||
...mapState('appState', ['activeAuthor']),
|
||||
resolvedAuthorName() {
|
||||
const pieces = this.name.match(/[,&]/g)
|
||||
|
||||
if (!pieces) {
|
||||
return [this.name]
|
||||
}
|
||||
|
||||
return this.name.split(/[,&]/g)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleAuthorClick() {
|
||||
if (!this.activeAuthor !== this.name) {
|
||||
this.$store.commit('appState/setActiveAuthor', this.name)
|
||||
handleAuthorClick(piece) {
|
||||
if (!this.activeAuthor !== piece) {
|
||||
this.$store.commit('appState/setActiveAuthor', piece)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,7 +12,11 @@ export const checkItem = ({
|
||||
return false
|
||||
}
|
||||
|
||||
if (activeAuthor && decodeURI(activeAuthor) !== author.name) {
|
||||
if (
|
||||
activeAuthor &&
|
||||
((author.name && !author.name.includes(decodeURI(activeAuthor))) ||
|
||||
!author.name)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user