From 068c9724e45fe801ecedbea491234d0b95695629 Mon Sep 17 00:00:00 2001
From: Edijs <iamedijs@hotmail.com>
Date: Sun, 10 Mar 2019 16:58:12 -0700
Subject: Added new tab to display versions of BE/FE

---
 src/components/settings/settings.vue | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index d2346747..3ca7bdc0 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -261,6 +261,28 @@
           </div>
         </div>
       </div>
+      <div :label="$t('settings.version.title')" >
+        <div class="setting-item">
+          <ul class="setting-list">
+            <li>
+              <p>{{$t('settings.version.backend_version')}}</p>
+              <ul class="option-list">
+                <li>
+                  <div v-html="parseBackendVersion(backendVersion)"></div>
+                </li>
+              </ul>
+            </li>
+            <li>
+              <p>{{$t('settings.version.frontend_version')}}</p>
+              <ul class="option-list">
+                <li>
+                  <div v-html="parseFrontendVersion(frontendVersion)"></div>
+                </li>
+              </ul>
+            </li>
+          </ul>
+        </div>
+      </div>
     </tab-switcher>
 </keep-alive>
   </div>
-- 
cgit v1.2.3-70-g09d2


From 8952761370a9fc08a3f931940050ccbdd8df9767 Mon Sep 17 00:00:00 2001
From: Edijs <iamedijs@hotmail.com>
Date: Sun, 10 Mar 2019 18:06:51 -0700
Subject: Version links to BE/FE

---
 src/components/settings/settings.js     | 17 +++++++++--------
 src/components/settings/settings.vue    |  4 ++--
 src/services/version/version.service.js | 12 ++++--------
 3 files changed, 15 insertions(+), 18 deletions(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index d208ee5a..3579f6db 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -4,7 +4,10 @@ import { filter, trim } from 'lodash'
 import TabSwitcher from '../tab_switcher/tab_switcher.js'
 import StyleSwitcher from '../style_switcher/style_switcher.vue'
 import InterfaceLanguageSwitcher from '../interface_language_switcher/interface_language_switcher.vue'
-import { parseBackendVersionString, parseFrontendVersionString } from '../../services/version/version.service'
+import { extractCommit } from '../../services/version/version.service'
+
+const pleromaFeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma-fe/commit/'
+const pleromaBeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma/commit/'
 
 const settings = {
   data () {
@@ -101,14 +104,12 @@ const settings = {
     postFormats () {
       return this.$store.state.instance.postFormats || []
     },
-    instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel }
-  },
-  methods: {
-    parseBackendVersion (versionString) {
-      return parseBackendVersionString(versionString)
+    instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
+    frontendVersionLink () {
+      return pleromaFeCommitUrl + this.$store.state.instance.frontendVersion
     },
-    parseFrontendVersion (versionString) {
-      return parseFrontendVersionString(versionString)
+    backendVersionLink () {
+      return pleromaBeCommitUrl + extractCommit(this.$store.state.instance.backendVersion)
     }
   },
   watch: {
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 3ca7bdc0..17f1f1a1 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -268,7 +268,7 @@
               <p>{{$t('settings.version.backend_version')}}</p>
               <ul class="option-list">
                 <li>
-                  <div v-html="parseBackendVersion(backendVersion)"></div>
+                  <a :href="backendVersionLink" target="_blank">{{backendVersion}}</a>
                 </li>
               </ul>
             </li>
@@ -276,7 +276,7 @@
               <p>{{$t('settings.version.frontend_version')}}</p>
               <ul class="option-list">
                 <li>
-                  <div v-html="parseFrontendVersion(frontendVersion)"></div>
+                  <a :href="frontendVersionLink" target="_blank">{{frontendVersion}}</a>
                 </li>
               </ul>
             </li>
diff --git a/src/services/version/version.service.js b/src/services/version/version.service.js
index 6c5036c1..a750b0dd 100644
--- a/src/services/version/version.service.js
+++ b/src/services/version/version.service.js
@@ -1,10 +1,6 @@
 
-export const parseBackendVersionString = versionString => {
-  const regex = /(-g)(\w+)$/i
-  const replacer = '$1<a href="https://git.pleroma.social/pleroma/pleroma/commit/$2" target="_blank">$2</a>'
-  return versionString.replace(regex, replacer)
-}
-
-export const parseFrontendVersionString = versionString => {
-  return `<a href="https://git.pleroma.social/pleroma/pleroma-fe/commit/${versionString}" target="_blank">#${versionString}</a>`
+export const extractCommit = versionString => {
+  const regex = /-g(\w+)$/i
+  const matches = versionString.match(regex)
+  return matches ? matches[1] : ''
 }
-- 
cgit v1.2.3-70-g09d2


From 9857002bf5dc902302644e981712b611124a5845 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Sat, 2 Mar 2019 08:07:14 -0500
Subject: Add hideMutedPosts setting and wire up to post-returning endpoints

---
 src/boot/after_store.js                                   | 1 +
 src/components/settings/settings.js                       | 8 ++++++++
 src/components/settings/settings.vue                      | 4 ++++
 src/i18n/en.json                                          | 1 +
 src/modules/config.js                                     | 1 +
 src/modules/instance.js                                   | 1 +
 src/services/api/api.service.js                           | 3 ++-
 src/services/timeline_fetcher/timeline_fetcher.service.js | 4 ++++
 8 files changed, 22 insertions(+), 1 deletion(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index a5f8c978..f5e84cbc 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -97,6 +97,7 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
   copyInstanceOption('showInstanceSpecificPanel')
   copyInstanceOption('scopeOptionsEnabled')
   copyInstanceOption('formattingOptionsEnabled')
+  copyInstanceOption('hideMutedPosts')
   copyInstanceOption('collapseMessageWithSubject')
   copyInstanceOption('loginMethod')
   copyInstanceOption('scopeCopy')
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index b77c5197..1d5f75ed 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -47,6 +47,11 @@ const settings = {
       pauseOnUnfocusedLocal: user.pauseOnUnfocused,
       hoverPreviewLocal: user.hoverPreview,
 
+      hideMutedPostsLocal: typeof user.hideMutedPosts === 'undefined'
+        ? instance.hideMutedPosts
+        : user.hideMutedPosts,
+      hideMutedPostsDefault: this.$t('settings.values.' + instance.hideMutedPosts),
+
       collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined'
         ? instance.collapseMessageWithSubject
         : user.collapseMessageWithSubject,
@@ -177,6 +182,9 @@ const settings = {
       value = filter(value.split('\n'), (word) => trim(word).length > 0)
       this.$store.dispatch('setOption', { name: 'muteWords', value })
     },
+    hideMutedPostsLocal (value) {
+      this.$store.dispatch('setOption', { name: 'hideMutedPosts', value })
+    },
     collapseMessageWithSubjectLocal (value) {
       this.$store.dispatch('setOption', { name: 'collapseMessageWithSubject', value })
     },
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 17f1f1a1..33dad549 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -36,6 +36,10 @@
         <div class="setting-item">
           <h2>{{$t('nav.timeline')}}</h2>
           <ul class="setting-list">
+            <li>
+              <input type="checkbox" id="hideMutedPosts" v-model="hideMutedPostsLocal">
+              <label for="hideMutedPosts">{{$t('settings.hide_muted_posts')}} {{$t('settings.instance_default', { value: hideMutedPostsDefault })}}</label>
+            </li>
             <li>
               <input type="checkbox" id="collapseMessageWithSubject" v-model="collapseMessageWithSubjectLocal">
               <label for="collapseMessageWithSubject">
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 68503f99..ecf9628f 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -153,6 +153,7 @@
     "general": "General",
     "hide_attachments_in_convo": "Hide attachments in conversations",
     "hide_attachments_in_tl": "Hide attachments in timeline",
+    "hide_muted_posts": "Hide posts of muted users",
     "max_thumbnails": "Maximum amount of thumbnails per post",
     "hide_isp": "Hide instance-specific panel",
     "preload_images": "Preload images",
diff --git a/src/modules/config.js b/src/modules/config.js
index 1c30c203..c5491c01 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -5,6 +5,7 @@ const browserLocale = (window.navigator.language || 'en').split('-')[0]
 
 const defaultState = {
   colors: {},
+  hideMutedPosts: undefined, // instance default
   collapseMessageWithSubject: undefined, // instance default
   hideAttachments: false,
   hideAttachmentsInConv: false,
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 155aa2eb..f778ac4d 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -18,6 +18,7 @@ const defaultState = {
   scopeOptionsEnabled: true,
   formattingOptionsEnabled: false,
   alwaysShowSubjectInput: true,
+  hideMutedPosts: false,
   collapseMessageWithSubject: false,
   hidePostStats: false,
   hideUserStats: false,
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 14bc919f..73ea15aa 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -345,7 +345,7 @@ const fetchStatus = ({id, credentials}) => {
     .then((data) => parseStatus(data))
 }
 
-const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false}) => {
+const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false, withMuted = false}) => {
   const timelineUrls = {
     public: PUBLIC_TIMELINE_URL,
     friends: FRIENDS_TIMELINE_URL,
@@ -381,6 +381,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
   }
 
   params.push(['count', 20])
+  params.push(['with_muted', withMuted])
 
   const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
   url += `?${queryString}`
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 6f99616f..8e954cdf 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -19,6 +19,9 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
   const args = { timeline, credentials }
   const rootState = store.rootState || store.state
   const timelineData = rootState.statuses.timelines[camelCase(timeline)]
+  const hideMutedPosts = typeof rootState.config.hideMutedPosts === 'undefined'
+    ? rootState.instance.hideMutedPosts
+    : rootState.config.hideMutedPosts
 
   if (older) {
     args['until'] = until || timelineData.minId
@@ -28,6 +31,7 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
 
   args['userId'] = userId
   args['tag'] = tag
+  args['withMuted'] = !hideMutedPosts
 
   const numStatusesBeforeFetch = timelineData.statuses.length
 
-- 
cgit v1.2.3-70-g09d2

