refactor
This commit is contained in:
parent
73b53c2afd
commit
bd0a0bf0be
|
@ -1,4 +1,4 @@
|
||||||
<article class="status-article {{getClasses(originalStatus, timelineType, isStatusInOwnThread)}}"
|
<article class="{{className}}"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
delegate-key="{{delegateKey}}"
|
delegate-key="{{delegateKey}}"
|
||||||
focus-key="{{delegateKey}}"
|
focus-key="{{delegateKey}}"
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<StatusSidebar :isStatusInOwnThread :originalAccount />
|
<StatusSidebar :isStatusInOwnThread :originalAccount />
|
||||||
{{#if originalStatus.spoiler_text}}
|
{{#if originalStatus.spoiler_text}}
|
||||||
<StatusSpoiler :isStatusInOwnThread :isStatusInNotification
|
<StatusSpoiler :isStatusInOwnThread :isStatusInNotification
|
||||||
:originalStatus :uuid
|
:originalStatus :uuid :spoilerShown
|
||||||
on:recalculateHeight />
|
on:recalculateHeight />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if !originalStatus.spoiler_text || spoilerShown}}
|
{{#if !originalStatus.spoiler_text || spoilerShown}}
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<StatusDetails :originalStatus :originalStatusId />
|
<StatusDetails :originalStatus :originalStatusId />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<StatusToolbar :originalStatus :originalStatusId :originalAccountId
|
<StatusToolbar :originalStatus :originalStatusId :originalAccountId
|
||||||
:isStatusInOwnThread :uuid />
|
:isStatusInOwnThread :uuid :visibility />
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -129,15 +129,6 @@
|
||||||
StatusSpoiler
|
StatusSpoiler
|
||||||
},
|
},
|
||||||
store: () => store,
|
store: () => store,
|
||||||
helpers: {
|
|
||||||
getClasses(originalStatus, timelineType, isStatusInOwnThread) {
|
|
||||||
return classname(
|
|
||||||
originalStatus.visibility === 'direct' && 'status-direct',
|
|
||||||
timelineType !== 'search' && 'status-in-timeline',
|
|
||||||
isStatusInOwnThread && 'status-in-own-thread'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
onClickOrKeydown(e) {
|
onClickOrKeydown(e) {
|
||||||
let { type, keyCode } = e
|
let { type, keyCode } = e
|
||||||
|
@ -167,6 +158,7 @@
|
||||||
accountId: (account) => account.id,
|
accountId: (account) => account.id,
|
||||||
originalAccount: (originalStatus) => originalStatus.account,
|
originalAccount: (originalStatus) => originalStatus.account,
|
||||||
originalAccountId: (originalAccount) => originalAccount.id,
|
originalAccountId: (originalAccount) => originalAccount.id,
|
||||||
|
visibility: (originalStatus) => originalStatus.visibility,
|
||||||
uuid: ($currentInstance, timelineType, timelineValue, notificationId, statusId) => {
|
uuid: ($currentInstance, timelineType, timelineValue, notificationId, statusId) => {
|
||||||
return `${$currentInstance}/${timelineType}/${timelineValue}/${notificationId || ''}/${statusId}`
|
return `${$currentInstance}/${timelineType}/${timelineValue}/${notificationId || ''}/${statusId}`
|
||||||
},
|
},
|
||||||
|
@ -179,14 +171,22 @@
|
||||||
notification.type !== 'mention' && notification.status.id === originalStatusId
|
notification.type !== 'mention' && notification.status.id === originalStatusId
|
||||||
},
|
},
|
||||||
spoilerShown: ($spoilersShown, uuid) => !!$spoilersShown[uuid],
|
spoilerShown: ($spoilersShown, uuid) => !!$spoilersShown[uuid],
|
||||||
ariaLabel: (originalAccount, originalStatus) => {
|
ariaLabel: (originalAccount, originalStatus, visibility) => {
|
||||||
return (originalStatus.visibility === 'direct' ? 'Direct message' : 'Status') +
|
return (visibility === 'direct' ? 'Direct message' : 'Status') +
|
||||||
` by ${originalAccount.display_name || originalAccount.username}`
|
` by ${originalAccount.display_name || originalAccount.username}`
|
||||||
},
|
},
|
||||||
showHeader: (notification, status, timelineType) => {
|
showHeader: (notification, status, timelineType) => {
|
||||||
return (notification && (notification.type === 'reblog' || notification.type === 'favourite'))
|
return (notification && (notification.type === 'reblog' || notification.type === 'favourite'))
|
||||||
|| status.reblog
|
|| status.reblog
|
||||||
|| timelineType === 'pinned'
|
|| timelineType === 'pinned'
|
||||||
|
},
|
||||||
|
className: (visibility, timelineType, isStatusInOwnThread) => {
|
||||||
|
return classname(
|
||||||
|
'status-article',
|
||||||
|
visibility === 'direct' && 'status-direct',
|
||||||
|
timelineType !== 'search' && 'status-in-timeline',
|
||||||
|
isStatusInOwnThread && 'status-in-own-thread'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
},
|
},
|
||||||
store: () => store,
|
store: () => store,
|
||||||
computed: {
|
computed: {
|
||||||
spoilerShown: ($spoilersShown, uuid) => !!$spoilersShown[uuid],
|
|
||||||
delegateKey: (uuid) => `spoiler-${uuid}`
|
delegateKey: (uuid) => `spoiler-${uuid}`
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -88,7 +88,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
visibility: (originalStatus) => originalStatus.visibility,
|
|
||||||
reblogLabel: (visibility) => {
|
reblogLabel: (visibility) => {
|
||||||
switch (visibility) {
|
switch (visibility) {
|
||||||
case 'private':
|
case 'private':
|
||||||
|
|
Loading…
Reference in a new issue