diff options
| author | lambadalambda <gitgud@rogerbraun.net> | 2017-04-09 16:21:54 -0400 |
|---|---|---|
| committer | lambadalambda <gitgud@rogerbraun.net> | 2017-04-09 16:21:54 -0400 |
| commit | 7ee87c7618bfba986ec7a04581273629a1db9983 (patch) | |
| tree | 5a380aafa6c821d47e0d1efedddd95811efda87f /src/components/status/status.js | |
| parent | f3ca011fbedb2ce6271bcc887d290828ccd1d284 (diff) | |
| parent | cd959d9df8c5cec8361892d92daf524ecfa4c76f (diff) | |
Merge branch 'feature/filtering' into 'develop'
Feature/filtering
See merge request !68
Diffstat (limited to 'src/components/status/status.js')
| -rw-r--r-- | src/components/status/status.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/components/status/status.js b/src/components/status/status.js index 87fff879..bb026fe1 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -4,6 +4,7 @@ import RetweetButton from '../retweet_button/retweet_button.vue' import DeleteButton from '../delete_button/delete_button.vue' import PostStatusForm from '../post_status_form/post_status_form.vue' import UserCardContent from '../user_card_content/user_card_content.vue' +import { filter } from 'lodash' const Status = { props: [ @@ -19,6 +20,9 @@ const Status = { userExpanded: false }), computed: { + muteWords () { + return this.$store.state.config.muteWords + }, hideAttachments () { return (this.$store.state.config.hideAttachments && !this.inConversation) || (this.$store.state.config.hideAttachmentsInConv && this.inConversation) @@ -35,7 +39,15 @@ const Status = { loggedIn () { return !!this.$store.state.users.currentUser }, - muted () { return !this.unmuted && this.status.user.muted }, + muteWordHits () { + const statusText = this.status.text.toLowerCase() + const hits = filter(this.muteWords, (muteWord) => { + return statusText.includes(muteWord.toLowerCase()) + }) + + return hits + }, + muted () { return !this.unmuted && (this.status.user.muted || this.muteWordHits.length > 0) }, isReply () { return !!this.status.in_reply_to_status_id }, borderColor () { return { |
