scrobbles age setting
This commit is contained in:
parent
23edfe7b91
commit
def68e9cda
|
@ -1,6 +1,7 @@
|
||||||
import { filter, trim, debounce } from 'lodash'
|
import { filter, trim, debounce } from 'lodash'
|
||||||
import BooleanSetting from '../helpers/boolean_setting.vue'
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||||
import ChoiceSetting from '../helpers/choice_setting.vue'
|
import ChoiceSetting from '../helpers/choice_setting.vue'
|
||||||
|
import SizeSetting from '../helpers/size_setting.vue'
|
||||||
import IntegerSetting from '../helpers/integer_setting.vue'
|
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
|
|
||||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
@ -19,6 +20,7 @@ const FilteringTab = {
|
||||||
components: {
|
components: {
|
||||||
BooleanSetting,
|
BooleanSetting,
|
||||||
ChoiceSetting,
|
ChoiceSetting,
|
||||||
|
SizeSetting,
|
||||||
IntegerSetting
|
IntegerSetting
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -96,6 +96,16 @@
|
||||||
{{ $t('settings.hide_scrobbles') }}
|
{{ $t('settings.hide_scrobbles') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<SizeSetting
|
||||||
|
key="hideScrobblesAfter"
|
||||||
|
path="hideScrobblesAfter"
|
||||||
|
:units="['m', 'h', 'd']"
|
||||||
|
expert="1"
|
||||||
|
>
|
||||||
|
{{ $t('settings.hide_scrobbles_after') }}
|
||||||
|
</SizeSetting>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -414,7 +414,25 @@ const Status = {
|
||||||
return this.quotedStatus && this.displayQuote
|
return this.quotedStatus && this.displayQuote
|
||||||
},
|
},
|
||||||
scrobblePresent () {
|
scrobblePresent () {
|
||||||
return !this.mergedConfig.hideScrobbles && this.status.user.latestScrobble && this.status.user.latestScrobble.artist
|
if (this.mergedConfig.hideScrobbles) return false
|
||||||
|
if (!this.status.user.latestScrobble) return false
|
||||||
|
const value = this.mergedConfig.hideScrobblesAfter.match(/\d+/gs)[0]
|
||||||
|
const unit = this.mergedConfig.hideScrobblesAfter.match(/\D+/gs)[0]
|
||||||
|
let multiplier = 60 * 1000 // minutes is smallest unit
|
||||||
|
switch (unit) {
|
||||||
|
case 'm':
|
||||||
|
multiplier *= 60 // hour
|
||||||
|
break
|
||||||
|
case 'd':
|
||||||
|
multiplier *= 60 // hour
|
||||||
|
multiplier *= 24 // day
|
||||||
|
break
|
||||||
|
}
|
||||||
|
const maxAge = Number(value) * multiplier
|
||||||
|
const createdAt = Date.parse(this.status.user.latestScrobble.created_at)
|
||||||
|
const age = Date.now() - createdAt
|
||||||
|
if (age > maxAge) return false
|
||||||
|
return this.status.user.latestScrobble.artist
|
||||||
},
|
},
|
||||||
scrobble () {
|
scrobble () {
|
||||||
return this.status.user.latestScrobble
|
return this.status.user.latestScrobble
|
||||||
|
|
|
@ -502,6 +502,7 @@
|
||||||
"mute_bot_posts": "Mute bot posts",
|
"mute_bot_posts": "Mute bot posts",
|
||||||
"hide_actor_type_indication": "Hide actor type (bots, groups, etc.) indication in posts",
|
"hide_actor_type_indication": "Hide actor type (bots, groups, etc.) indication in posts",
|
||||||
"hide_scrobbles": "Hide scrobbles",
|
"hide_scrobbles": "Hide scrobbles",
|
||||||
|
"hide_scrobbles_after": "Hide scrobbles older than",
|
||||||
"hide_all_muted_posts": "Hide muted posts",
|
"hide_all_muted_posts": "Hide muted posts",
|
||||||
"max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)",
|
"max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)",
|
||||||
"hide_isp": "Hide instance-specific panel",
|
"hide_isp": "Hide instance-specific panel",
|
||||||
|
|
|
@ -41,6 +41,7 @@ export const defaultState = {
|
||||||
hideAttachments: false,
|
hideAttachments: false,
|
||||||
hideAttachmentsInConv: false,
|
hideAttachmentsInConv: false,
|
||||||
hideScrobbles: false,
|
hideScrobbles: false,
|
||||||
|
hideScrobblesAfter: '2d',
|
||||||
maxThumbnails: 16,
|
maxThumbnails: 16,
|
||||||
hideNsfw: true,
|
hideNsfw: true,
|
||||||
preloadImage: true,
|
preloadImage: true,
|
||||||
|
|
Loading…
Reference in New Issue