mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge branch 'master' into deployment-secrets
This commit is contained in:
commit
895ba16ab1
@ -16,6 +16,7 @@ export default {
|
||||
Group: async (_object, params, context, _resolveInfo) => {
|
||||
const { isMember, id, slug, first, offset } = params
|
||||
let pagination = ''
|
||||
const orderBy = 'ORDER BY group.createdAt DESC'
|
||||
if (first !== undefined && offset !== undefined) pagination = `SKIP ${offset} LIMIT ${first}`
|
||||
const matchParams = { id, slug }
|
||||
removeUndefinedNullValuesFromObject(matchParams)
|
||||
@ -29,6 +30,7 @@ export default {
|
||||
WITH group, membership
|
||||
WHERE (group.groupType IN ['public', 'closed']) OR (group.groupType = 'hidden' AND membership.role IN ['usual', 'admin', 'owner'])
|
||||
RETURN group {.*, myRole: membership.role}
|
||||
${orderBy}
|
||||
${pagination}
|
||||
`
|
||||
} else {
|
||||
@ -39,6 +41,7 @@ export default {
|
||||
WITH group
|
||||
WHERE group.groupType IN ['public', 'closed']
|
||||
RETURN group {.*, myRole: NULL}
|
||||
${orderBy}
|
||||
${pagination}
|
||||
`
|
||||
} else {
|
||||
@ -48,6 +51,7 @@ export default {
|
||||
WITH group, membership
|
||||
WHERE (group.groupType IN ['public', 'closed']) OR (group.groupType = 'hidden' AND membership.role IN ['usual', 'admin', 'owner'])
|
||||
RETURN group {.*, myRole: membership.role}
|
||||
${orderBy}
|
||||
${pagination}
|
||||
`
|
||||
}
|
||||
|
||||
@ -59,8 +59,8 @@ describe('NotificationsTable.vue', () => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders a table', () => {
|
||||
expect(wrapper.find('.ds-table').exists()).toBe(true)
|
||||
it('renders a grid table', () => {
|
||||
expect(wrapper.find('.notification-grid').exists()).toBe(true)
|
||||
})
|
||||
|
||||
describe('renders 4 columns', () => {
|
||||
@ -84,7 +84,7 @@ describe('NotificationsTable.vue', () => {
|
||||
describe('Post', () => {
|
||||
let firstRowNotification
|
||||
beforeEach(() => {
|
||||
firstRowNotification = wrapper.findAll('tbody tr').at(0)
|
||||
firstRowNotification = wrapper.findAll('.notification-grid-row').at(0)
|
||||
})
|
||||
|
||||
it('renders the author', () => {
|
||||
@ -117,7 +117,7 @@ describe('NotificationsTable.vue', () => {
|
||||
describe('Comment', () => {
|
||||
let secondRowNotification
|
||||
beforeEach(() => {
|
||||
secondRowNotification = wrapper.findAll('tbody tr').at(1)
|
||||
secondRowNotification = wrapper.findAll('.notification-grid-row').at(1)
|
||||
})
|
||||
|
||||
it('renders the author', () => {
|
||||
|
||||
@ -1,8 +1,27 @@
|
||||
<template>
|
||||
<ds-table v-if="notifications && notifications.length" :data="notifications" :fields="fields">
|
||||
<template #icon="scope">
|
||||
<div class="notification-grid" v-if="notifications && notifications.length">
|
||||
<ds-grid>
|
||||
<ds-grid-item v-if="!isMobile" column-span="fullWidth">
|
||||
<ds-grid class="header-grid">
|
||||
<ds-grid-item v-for="field in fields" :key="field.label" class="ds-table-head-col">
|
||||
{{ field.label }}
|
||||
</ds-grid-item>
|
||||
</ds-grid>
|
||||
</ds-grid-item>
|
||||
<ds-grid-item
|
||||
v-for="notification in notifications"
|
||||
:key="notification.id"
|
||||
column-span="fullWidth"
|
||||
class="notification-grid-row"
|
||||
>
|
||||
<ds-grid>
|
||||
<ds-grid-item>
|
||||
<ds-flex class="user-section">
|
||||
<ds-flex-item :width="{ base: '20%' }">
|
||||
<div>
|
||||
<base-card :wide-content="true">
|
||||
<base-icon
|
||||
v-if="scope.row.from.post"
|
||||
v-if="notification.from.post"
|
||||
name="comment"
|
||||
v-tooltip="{ content: $t('notifications.comment'), placement: 'right' }"
|
||||
/>
|
||||
@ -11,52 +30,79 @@
|
||||
name="bookmark"
|
||||
v-tooltip="{ content: $t('notifications.post'), placement: 'right' }"
|
||||
/>
|
||||
</template>
|
||||
<template #user="scope">
|
||||
</base-card>
|
||||
</div>
|
||||
</ds-flex-item>
|
||||
<ds-flex-item>
|
||||
<div>
|
||||
<base-card :wide-content="true">
|
||||
<ds-space margin-bottom="base">
|
||||
<client-only>
|
||||
<user-teaser
|
||||
:user="scope.row.from.author"
|
||||
:date-time="scope.row.from.createdAt"
|
||||
:class="{ 'notification-status': scope.row.read }"
|
||||
:user="notification.from.author"
|
||||
:date-time="notification.from.createdAt"
|
||||
:class="{ 'notification-status': notification.read }"
|
||||
/>
|
||||
</client-only>
|
||||
</ds-space>
|
||||
<ds-text :class="{ 'notification-status': scope.row.read, reason: true }">
|
||||
{{ $t(`notifications.reason.${scope.row.reason}`) }}
|
||||
<ds-text :class="{ 'notification-status': notification.read, reason: true }">
|
||||
{{ $t(`notifications.reason.${notification.reason}`) }}
|
||||
</ds-text>
|
||||
</template>
|
||||
<template #post="scope">
|
||||
</base-card>
|
||||
</div>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
</ds-grid-item>
|
||||
<ds-grid-item>
|
||||
<ds-flex class="content-section" :direction="{ base: 'column', xs: 'row' }">
|
||||
<ds-flex-item>
|
||||
<base-card :wide-content="true">
|
||||
<nuxt-link
|
||||
class="notification-mention-post"
|
||||
:class="{ 'notification-status': scope.row.read }"
|
||||
:class="{ 'notification-status': notification.read }"
|
||||
:to="{
|
||||
name: 'post-id-slug',
|
||||
params: params(scope.row.from),
|
||||
hash: hashParam(scope.row.from),
|
||||
params: params(notification.from),
|
||||
hash: hashParam(notification.from),
|
||||
}"
|
||||
@click.native="markNotificationAsRead(scope.row.from.id)"
|
||||
@click.native="markNotificationAsRead(notification.from.id)"
|
||||
>
|
||||
<b>{{ scope.row.from.title || scope.row.from.post.title | truncate(50) }}</b>
|
||||
</nuxt-link>
|
||||
</template>
|
||||
<template #content="scope">
|
||||
<b :class="{ 'notification-status': scope.row.read }">
|
||||
{{ scope.row.from.contentExcerpt | removeHtml }}
|
||||
<b>
|
||||
{{ notification.from.title || notification.from.post.title | truncate(50) }}
|
||||
</b>
|
||||
</template>
|
||||
</ds-table>
|
||||
</nuxt-link>
|
||||
</base-card>
|
||||
</ds-flex-item>
|
||||
<ds-flex-item>
|
||||
<base-card :wide-content="true">
|
||||
<b :class="{ 'notification-status': notification.read }">
|
||||
{{ notification.from.contentExcerpt | removeHtml }}
|
||||
</b>
|
||||
</base-card>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
</ds-grid-item>
|
||||
</ds-grid>
|
||||
</ds-grid-item>
|
||||
</ds-grid>
|
||||
</div>
|
||||
<hc-empty v-else icon="alert" :message="$t('notifications.empty')" />
|
||||
</template>
|
||||
<script>
|
||||
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||
import HcEmpty from '~/components/Empty/Empty'
|
||||
import BaseCard from '../_new/generic/BaseCard/BaseCard.vue'
|
||||
import mobile from '~/mixins/mobile'
|
||||
|
||||
const maxMobileWidth = 768 // at this point the table breaks down
|
||||
|
||||
export default {
|
||||
components: {
|
||||
UserTeaser,
|
||||
HcEmpty,
|
||||
BaseCard,
|
||||
},
|
||||
mixins: [mobile(maxMobileWidth)],
|
||||
props: {
|
||||
notifications: { type: Array, default: () => [] },
|
||||
},
|
||||
@ -106,4 +152,39 @@ export default {
|
||||
.notification-status {
|
||||
opacity: $opacity-soft;
|
||||
}
|
||||
/* fix to override flex-wrap style of ds flex component */
|
||||
.notification-grid .content-section {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.notification-grid .ds-grid.header-grid {
|
||||
grid-template-columns: 1fr 4fr 3fr 3fr !important;
|
||||
}
|
||||
.notification-grid-row {
|
||||
border-top: 1px dotted #e5e3e8;
|
||||
}
|
||||
.notification-grid .base-card {
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
padding: 16px 4px;
|
||||
}
|
||||
/* dirty fix to override broken styleguide inline-styles */
|
||||
.notification-grid .ds-grid {
|
||||
grid-template-columns: 5fr 6fr !important;
|
||||
grid-auto-rows: auto !important;
|
||||
grid-template-rows: 1fr;
|
||||
gap: 0px !important;
|
||||
}
|
||||
@media screen and (max-width: 768px) {
|
||||
.notification-grid .ds-grid {
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
.notification-grid .content-section {
|
||||
border-top: 1px dotted #e5e3e8;
|
||||
}
|
||||
.notification-grid-row {
|
||||
box-shadow: 0px 12px 26px -4px rgb(0 0 0 / 10%);
|
||||
margin-top: 5px;
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -15,7 +15,13 @@
|
||||
<img :src="post.image | proxyApiUrl" class="image" />
|
||||
</template>
|
||||
<client-only>
|
||||
<div class="post-user-row">
|
||||
<user-teaser :user="post.author" :group="post.group" :date-time="post.createdAt" />
|
||||
<hc-ribbon
|
||||
:class="[isPinned ? '--pinned' : '', post.image ? 'post-ribbon-w-img' : 'post-ribbon']"
|
||||
:text="isPinned ? $t('post.pinned') : $t('post.name')"
|
||||
/>
|
||||
</div>
|
||||
</client-only>
|
||||
<h2 class="title hyphenate-text">{{ post.title }}</h2>
|
||||
<!-- TODO: replace editor content with tiptap render view -->
|
||||
@ -73,10 +79,6 @@
|
||||
</client-only>
|
||||
</footer>
|
||||
</base-card>
|
||||
<hc-ribbon
|
||||
:class="{ '--pinned': isPinned }"
|
||||
:text="isPinned ? $t('post.pinned') : $t('post.name')"
|
||||
/>
|
||||
</nuxt-link>
|
||||
</template>
|
||||
|
||||
@ -192,19 +194,38 @@ export default {
|
||||
display: block;
|
||||
height: 100%;
|
||||
color: $text-color-base;
|
||||
}
|
||||
|
||||
> .ribbon {
|
||||
.post-user-row {
|
||||
position: relative;
|
||||
|
||||
> .post-ribbon-w-img {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: -7px;
|
||||
// 14px (~height of ribbon element) + 24px(=margin of hero image)
|
||||
top: -38px;
|
||||
// 7px+24px(=padding of parent)
|
||||
right: -31px;
|
||||
}
|
||||
> .post-ribbon {
|
||||
position: absolute;
|
||||
// 14px (~height of ribbon element) + 24px(=margin of hero image)
|
||||
top: -24px;
|
||||
// 7px(=offset)+24px(=margin of parent)
|
||||
right: -31px;
|
||||
}
|
||||
}
|
||||
|
||||
.post-teaser > .base-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: visible;
|
||||
height: 100%;
|
||||
|
||||
> .hero-image {
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
}
|
||||
|
||||
&.--blur-image > .hero-image > .image {
|
||||
filter: blur($blur-radius);
|
||||
}
|
||||
|
||||
@ -134,15 +134,15 @@ describe('PostIndex', () => {
|
||||
})
|
||||
|
||||
describe('donation-info', () => {
|
||||
it('shows donation-info on default', () => {
|
||||
it('hides donation-info on default', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.find('.top-info-bar').exists()).toBe(true)
|
||||
expect(wrapper.find('.top-info-bar').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('hides donation-info if not "showDonations"', async () => {
|
||||
it('shows donation-info if "showDonations"', async () => {
|
||||
wrapper = Wrapper()
|
||||
await wrapper.setData({ showDonations: false })
|
||||
expect(wrapper.find('.top-info-bar').exists()).toBe(false)
|
||||
await wrapper.setData({ showDonations: true })
|
||||
expect(wrapper.find('.top-info-bar').exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -152,7 +152,7 @@ export default {
|
||||
hideByScroll: false,
|
||||
revScrollpos: 0,
|
||||
showFilter: false,
|
||||
showDonations: true,
|
||||
showDonations: false,
|
||||
goal: 15000,
|
||||
progress: 7000,
|
||||
posts: [],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user