@@ -44,10 +44,6 @@ const expirationDateTime = computed(() =>
4444 DateTime .fromMillis (poll .configuration .expire * 1000 ),
4545)
4646
47- const createdDateTime = computed (() =>
48- DateTime .fromMillis (poll .status .created * 1000 ),
49- )
50-
5147const archiveDateTime = computed (() =>
5248 DateTime .fromMillis (poll .status .archivedDate * 1000 ),
5349)
@@ -75,25 +71,48 @@ const expiryClass = computed(() => {
7571 return ' success'
7672})
7773
78- const descriptionLine = computed (() => {
79- if (preferencesStore .user .verbosePollsList ) {
80- if (poll .configuration .description ) {
81- return poll .configuration .description
74+ const pollDetails = computed (() => {
75+ if (noLink || ! poll .permissions .view ) {
76+ return {
77+ iconComponent: LockPollIcon ,
78+ title: t (' polls' , ' No access' ),
79+ description: t (' polls' , ' No access to this poll of {ownerName}.' , {
80+ ownerName: poll .owner .displayName ,
81+ }),
8282 }
83- return t (' polls' , ' No description provided' )
8483 }
85-
8684 if (poll .status .isArchived ) {
87- return t (' polls' , ' Archived {relativeTime}' , {
88- relativeTime: archiveDateTime .value .toRelative () as string ,
89- })
85+ return {
86+ iconComponent: ArchivedPollIcon ,
87+ title: t (' polls' , ' Archived poll' ),
88+ description: t (' polls' , ' Archived {relativeTime}' , {
89+ relativeTime: archiveDateTime .value .toRelative () as string ,
90+ }),
91+ }
92+ }
93+ if (poll .configuration .access === ' private' ) {
94+ return {
95+ iconComponent: PrivatePollIcon ,
96+ title: t (' polls' , ' Private poll' ),
97+ description: t (
98+ ' polls' ,
99+ ' Private poll, only invited participants have access' ,
100+ ),
101+ }
102+ }
103+ return {
104+ iconComponent: OpenPollIcon ,
105+ title: t (' polls' , ' Openly accessible poll' ),
106+ description: t (
107+ ' polls' ,
108+ ' Open poll, accessible to all users of this instance and invited participants' ,
109+ ),
90110 }
91-
92- return t (' polls' , ' Started {relativeTime} from {ownerName}' , {
93- ownerName: poll .owner .displayName ,
94- relativeTime: createdDateTime .value .toRelative () as string ,
95- })
96111})
112+
113+ const descriptionLine = computed (
114+ () => poll .configuration .description || pollDetails .value .description ,
115+ )
97116 </script >
98117
99118<template >
@@ -113,7 +132,7 @@ const descriptionLine = computed(() => {
113132 </div >
114133
115134 <div class =" description_line" >
116- <LockPollIcon :size =" 16 " />
135+ <component :is = " pollDetails.iconComponent " :size =" 16" />
117136 <div class =" description" >
118137 {{
119138 t('polls', 'No access to this poll of {ownerName}.', {
@@ -143,27 +162,10 @@ const descriptionLine = computed(() => {
143162 </div >
144163
145164 <div class =" description_line" >
146- <ArchivedPollIcon
147- v-if ="
148- ! preferencesStore .user .verbosePollsList
149- && poll .status .isArchived
150- "
151- :title =" t (' polls' , ' Archived poll' )"
152- :size =" 16 " />
153- <OpenPollIcon
154- v-else-if ="
155- ! preferencesStore .user .verbosePollsList
156- && poll .configuration .access === ' open'
157- "
158- :title =" t (' polls' , ' Openly accessible poll' )"
159- :size =" 16 " />
160- <PrivatePollIcon
161- v-else-if ="
162- ! preferencesStore .user .verbosePollsList
163- && poll .configuration .access === ' private'
164- "
165- :title =" t (' polls' , ' Private poll' )"
166- :size =" 16 " />
165+ <component
166+ :is =" pollDetails.iconComponent"
167+ :size =" 16"
168+ :title =" pollDetails.title" />
167169
168170 <span class =" description" >
169171 {{ descriptionLine }}
@@ -322,6 +324,9 @@ const descriptionLine = computed(() => {
322324 justify-content : space-between ;
323325 }
324326 .description_line {
327+ display : grid ;
328+ grid-template-columns : max-content 1fr ;
329+ gap : 0.25rem ;
325330 opacity : 0.5 ;
326331 }
327332 .badges {
0 commit comments