mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Compare commits
11 Commits
b3d9e563e2
...
825d3dff80
| Author | SHA1 | Date | |
|---|---|---|---|
| 825d3dff80 | |||
| ccb8727a09 | |||
| 8f71d4f5fb | |||
| 28071bc537 | |||
| 8105c451fa | |||
| a69e0011bf | |||
|
|
c78f8deee9 | ||
|
|
2cabe0f4d2 | ||
|
|
0ac7bf908c | ||
|
|
0368676b26 | ||
|
|
cd7931b77b |
6
.github/workflows/check-documentation.yml
vendored
6
.github/workflows/check-documentation.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
documentation: ${{ steps.changes.outputs.documentation }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Check for markdown file changes
|
||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
@ -28,7 +28,7 @@ jobs:
|
||||
if: needs.files-changed.outputs.markdown == 'true'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Remove uncheckable documentation files
|
||||
run: rm -rf ./CHANGELOG.md # workaround until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/183 has been done
|
||||
@ -51,7 +51,7 @@ jobs:
|
||||
if: needs.files-changed.outputs.documentation == 'true'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Setup Node 20
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
|
||||
@ -22,7 +22,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Cleanup
|
||||
run: |
|
||||
|
||||
4
.github/workflows/deploy-documentation.yml
vendored
4
.github/workflows/deploy-documentation.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
||||
documentation: ${{ steps.changes.outputs.documentation }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Check for file changes
|
||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
@ -27,7 +27,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Setup Node 20
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
|
||||
2
.github/workflows/docker-push.yml
vendored
2
.github/workflows/docker-push.yml
vendored
@ -59,7 +59,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
|
||||
with:
|
||||
|
||||
4
.github/workflows/publish.yml
vendored
4
.github/workflows/publish.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
with:
|
||||
fetch-depth: 0 # Fetch full History for changelog
|
||||
- name: Setup env
|
||||
@ -54,7 +54,7 @@ jobs:
|
||||
needs: [github_tag]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
with:
|
||||
fetch-depth: 0 # Fetch full History for changelog
|
||||
- name: Setup env
|
||||
|
||||
10
.github/workflows/test-backend.yml
vendored
10
.github/workflows/test-backend.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
backend: ${{ steps.changes.outputs.backend }}
|
||||
docker: ${{ steps.changes.outputs.docker }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Check for backend file changes
|
||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
@ -28,7 +28,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Neo4J | Build 'community' image
|
||||
run: |
|
||||
@ -49,7 +49,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: backend | Build 'test' image
|
||||
run: |
|
||||
@ -70,7 +70,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: backend | Lint
|
||||
run: cd backend && yarn && yarn run lint
|
||||
@ -84,7 +84,7 @@ jobs:
|
||||
checks: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Restore Neo4J cache
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.2
|
||||
|
||||
10
.github/workflows/test-e2e.yml
vendored
10
.github/workflows/test-e2e.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.2.2
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.2.2
|
||||
|
||||
- name: Copy backend env file
|
||||
run: |
|
||||
@ -46,7 +46,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.2.2
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.2.2
|
||||
|
||||
- name: Copy backend env file
|
||||
run: |
|
||||
@ -72,7 +72,7 @@ jobs:
|
||||
run: rm -rf /opt/hostedtoolcache
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.2.2
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.2.2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.4.0
|
||||
@ -120,7 +120,7 @@ jobs:
|
||||
run: rm -rf /opt/hostedtoolcache
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.2.2
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.2.2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.4.0
|
||||
@ -193,7 +193,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.2.2
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.2.2
|
||||
|
||||
- name: Full stack tests | cleanup cache
|
||||
run: |
|
||||
|
||||
10
.github/workflows/test-webapp.yml
vendored
10
.github/workflows/test-webapp.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
docker: ${{ steps.changes.outputs.docker }}
|
||||
webapp: ${{ steps.changes.outputs.webapp }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Check for frontend file changes
|
||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
@ -28,7 +28,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Check translation files
|
||||
run: |
|
||||
@ -42,7 +42,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Webapp | Build 'test' image
|
||||
run: |
|
||||
@ -62,7 +62,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: webapp | Lint
|
||||
run: cd webapp && yarn && yarn run lint
|
||||
@ -76,7 +76,7 @@ jobs:
|
||||
checks: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Restore webapp cache
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.2
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
"bcryptjs": "~3.0.3",
|
||||
"body-parser": "^1.20.3",
|
||||
"cheerio": "~1.1.2",
|
||||
"cross-env": "~10.0.0",
|
||||
"cross-env": "~10.1.0",
|
||||
"dotenv": "~17.0.1",
|
||||
"email-templates": "^12.0.3",
|
||||
"express": "^5.1.0",
|
||||
@ -72,7 +72,7 @@
|
||||
"metascraper-video": "^5.49.5",
|
||||
"metascraper-youtube": "^5.49.5",
|
||||
"migrate": "^2.1.0",
|
||||
"mime-types": "^3.0.1",
|
||||
"mime-types": "^3.0.2",
|
||||
"minimatch": "^10.1.1",
|
||||
"mustache": "^4.2.0",
|
||||
"neo4j-driver": "^4.4.11",
|
||||
@ -119,7 +119,7 @@
|
||||
"eslint-plugin-security": "^3.0.1",
|
||||
"jest": "^30.2.0",
|
||||
"nodemon": "~3.1.11",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier": "^3.7.4",
|
||||
"require-json5": "^1.3.0",
|
||||
"rosie": "^2.1.1",
|
||||
"ts-jest": "^29.4.5",
|
||||
|
||||
@ -478,6 +478,18 @@ export default {
|
||||
})
|
||||
).records.map((r) => r.get('inviteCodes'))
|
||||
},
|
||||
currentlyPinnedPostsCount: async (parent, _args, context: Context, _resolveInfo) => {
|
||||
if (!parent.id) {
|
||||
throw new Error('Can not identify selected Group!')
|
||||
}
|
||||
const result = await context.database.query({
|
||||
query: `
|
||||
MATCH (:User)-[pinned:GROUP_PINNED]->(pinnedPosts:Post)-[:IN]->(:Group {id: $group.id})
|
||||
RETURN toString(count(pinnedPosts)) as count`,
|
||||
variables: { group: parent },
|
||||
})
|
||||
return result.records[0].get('count')
|
||||
},
|
||||
...Resolver('Group', {
|
||||
undefinedToNull: ['deleted', 'disabled', 'locationName', 'about'],
|
||||
hasMany: {
|
||||
|
||||
@ -453,6 +453,64 @@ export default {
|
||||
}
|
||||
return unpinnedPost
|
||||
},
|
||||
pinGroupPost: async (_parent, params, context: Context, _resolveInfo) => {
|
||||
if (!context.user) {
|
||||
throw new Error('Missing authenticated user.')
|
||||
}
|
||||
const { config } = context
|
||||
|
||||
if (config.MAX_PINNED_POSTS === 0) {
|
||||
throw new Error('Pinned posts are not allowed!')
|
||||
}
|
||||
|
||||
// If MAX_PINNED_POSTS === 1 -> Delete old pin
|
||||
if (config.MAX_PINNED_POSTS === 1) {
|
||||
await context.database.write({
|
||||
query: `
|
||||
MATCH (post:Post {id: $params.id})-[:IN]->(group:Group)
|
||||
MATCH (:User)-[pinned:GROUP_PINNED]->(:Post)-[:IN]->(:Group {id: group.id})
|
||||
DELETE pinned`,
|
||||
variables: { user: context.user, params },
|
||||
})
|
||||
// If MAX_PINNED_POSTS !== 1 -> Check if max is reached
|
||||
} else {
|
||||
const result = await context.database.query({
|
||||
query: `
|
||||
MATCH (post:Post {id: $params.id})-[:IN]->(group:Group)
|
||||
MATCH (:User)-[pinned:GROUP_PINNED]->(pinnedPosts:Post)-[:IN]->(:Group {id: group.id})
|
||||
RETURN toString(count(pinnedPosts)) as count`,
|
||||
variables: { user: context.user, params },
|
||||
})
|
||||
if (result.records[0].get('count') >= config.MAX_PINNED_POSTS) {
|
||||
throw new Error('Reached maxed pinned posts already. Unpin a post first-')
|
||||
}
|
||||
}
|
||||
|
||||
// Set new pin
|
||||
const result = await context.database.write({
|
||||
query: `
|
||||
MATCH (user:User {id: $user.id})
|
||||
MATCH (post:Post {id: $params.id})-[:IN]->(group:Group)
|
||||
MERGE (user)-[pinned:GROUP_PINNED{createdAt: toString(datetime())}]->(post)
|
||||
RETURN post {.*, pinnedAt: pinned.createdAt}`,
|
||||
variables: { user: context.user, params },
|
||||
})
|
||||
|
||||
// Return post
|
||||
return result.records[0].get('post')
|
||||
},
|
||||
unpinGroupPost: async (_parent, params, context, _resolveInfo) => {
|
||||
const result = await context.database.write({
|
||||
query: `
|
||||
MATCH [pinned:GROUP_PINNED]->(post:Post {id: $postId})
|
||||
DELETE pinned
|
||||
RETURN post`,
|
||||
variables: { postId: params.id },
|
||||
})
|
||||
|
||||
// Return post
|
||||
return result.records[0].get('post')
|
||||
},
|
||||
markTeaserAsViewed: async (_parent, params, context, _resolveInfo) => {
|
||||
const session = context.driver.session()
|
||||
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
|
||||
|
||||
@ -48,6 +48,8 @@ type Group {
|
||||
|
||||
"inviteCodes to this group the current user has generated"
|
||||
inviteCodes: [InviteCode]! @neo4j_ignore
|
||||
|
||||
currentlyPinnedPostsCount: Int! @neo4j_ignore
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -241,8 +241,12 @@ type Mutation {
|
||||
DeletePost(id: ID!): Post
|
||||
AddPostEmotions(to: _PostInput!, data: _EMOTEDInput!): EMOTED
|
||||
RemovePostEmotions(to: _PostInput!, data: _EMOTEDInput!): EMOTED
|
||||
|
||||
pinPost(id: ID!): Post
|
||||
unpinPost(id: ID!): Post
|
||||
pinGroupPost(id: ID!): Post
|
||||
unpinGroupPost(id: ID!): Post
|
||||
|
||||
markTeaserAsViewed(id: ID!): Post
|
||||
pushPost(id: ID!): Post!
|
||||
unpushPost(id: ID!): Post!
|
||||
|
||||
@ -434,7 +434,7 @@ export default shield(
|
||||
Room: isAuthenticated,
|
||||
Message: isAuthenticated,
|
||||
UnreadRooms: isAuthenticated,
|
||||
PostsPinnedCounts: isAdmin,
|
||||
PostsPinnedCounts: isAuthenticated,
|
||||
|
||||
// Invite Code
|
||||
validateInviteCode: allow,
|
||||
@ -485,6 +485,8 @@ export default shield(
|
||||
VerifyEmailAddress: isAuthenticated,
|
||||
pinPost: isAdmin,
|
||||
unpinPost: isAdmin,
|
||||
pinGroupPost: isAuthenticated, // TODO: permissions
|
||||
unpinGroupPost: isAuthenticated, // TODO: permissions
|
||||
pushPost: isAdmin,
|
||||
unpushPost: isAdmin,
|
||||
UpdateDonations: isAdmin,
|
||||
|
||||
@ -4542,10 +4542,10 @@ create-require@^1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
|
||||
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
|
||||
|
||||
cross-env@~10.0.0:
|
||||
version "10.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-10.0.0.tgz#ba25823cfa1ed6af293dcded8796fa16cd162456"
|
||||
integrity sha512-aU8qlEK/nHYtVuN4p7UQgAwVljzMg8hB4YK5ThRqD2l/ziSnryncPNn7bMLt5cFYsKVKBh8HqLqyCoTupEUu7Q==
|
||||
cross-env@~10.1.0:
|
||||
version "10.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-10.1.0.tgz#cfd2a6200df9ed75bfb9cb3d7ce609c13ea21783"
|
||||
integrity sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==
|
||||
dependencies:
|
||||
"@epic-web/invariant" "^1.0.0"
|
||||
cross-spawn "^7.0.6"
|
||||
@ -8702,10 +8702,10 @@ mime-types@^2.1.12, mime-types@^2.1.35, mime-types@~2.1.22, mime-types@~2.1.24,
|
||||
dependencies:
|
||||
mime-db "1.52.0"
|
||||
|
||||
mime-types@^3.0.0, mime-types@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.1.tgz#b1d94d6997a9b32fd69ebaed0db73de8acb519ce"
|
||||
integrity sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==
|
||||
mime-types@^3.0.0, mime-types@^3.0.1, mime-types@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.2.tgz#39002d4182575d5af036ffa118100f2524b2e2ab"
|
||||
integrity sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==
|
||||
dependencies:
|
||||
mime-db "^1.54.0"
|
||||
|
||||
@ -9606,10 +9606,10 @@ prettier-linter-helpers@^1.0.0:
|
||||
dependencies:
|
||||
fast-diff "^1.1.2"
|
||||
|
||||
prettier@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.2.tgz#ccda02a1003ebbb2bfda6f83a074978f608b9393"
|
||||
integrity sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==
|
||||
prettier@^3.7.4:
|
||||
version "3.7.4"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.7.4.tgz#d2f8335d4b1cec47e1c8098645411b0c9dff9c0f"
|
||||
integrity sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==
|
||||
|
||||
pretty-format@30.0.5, pretty-format@^30.0.0:
|
||||
version "30.0.5"
|
||||
|
||||
@ -244,6 +244,27 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(this.resourceType, this.resource)
|
||||
if (
|
||||
this.resourceType === 'contribution' &&
|
||||
this.resource.group &&
|
||||
this.resource.group.myRole === 'owner' &&
|
||||
(this.canBeGroupPinned || this.resource.groupPinnedBy)
|
||||
) {
|
||||
routes.push({
|
||||
label: this.resource.groupPinnedBy
|
||||
? this.$t(`post.menu.groupUnpin`)
|
||||
: this.$t(`post.menu.groupPin`),
|
||||
callback: () => {
|
||||
this.$emit(
|
||||
this.resource.groupPinnedBy ? 'unpinGroupPost' : 'pinGroupPost',
|
||||
this.resource,
|
||||
)
|
||||
},
|
||||
icon: this.resource.groupPinnedBy ? 'unlink' : 'link',
|
||||
})
|
||||
}
|
||||
|
||||
return routes
|
||||
},
|
||||
isModerator() {
|
||||
@ -258,6 +279,14 @@ export default {
|
||||
(this.maxPinnedPosts > 1 && this.currentlyPinnedPosts < this.maxPinnedPosts)
|
||||
)
|
||||
},
|
||||
canBeGroupPinned() {
|
||||
return (
|
||||
this.maxPinnedPosts === 1 ||
|
||||
(this.maxPinnedPosts > 1 &&
|
||||
this.resource.group &&
|
||||
this.resource.group.currentlyPinnedPostsCount < this.maxPinnedPosts)
|
||||
)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openItem(route, toggleMenu) {
|
||||
|
||||
@ -112,6 +112,8 @@
|
||||
:is-owner="isAuthor"
|
||||
@pinPost="pinPost"
|
||||
@unpinPost="unpinPost"
|
||||
@pinGroupPost="pinGroupPost"
|
||||
@unpinGroupPost="unpinGroupPost"
|
||||
@pushPost="pushPost"
|
||||
@unpushPost="unpushPost"
|
||||
@toggleObservePost="toggleObservePost"
|
||||
@ -229,6 +231,12 @@ export default {
|
||||
unpinPost(post) {
|
||||
this.$emit('unpinPost', post)
|
||||
},
|
||||
pinGroupPost(post) {
|
||||
this.$emit('pinGroupPost', post)
|
||||
},
|
||||
unpinGroupPost(post) {
|
||||
this.$emit('unpinPost', post)
|
||||
},
|
||||
pushPost(post) {
|
||||
this.$emit('pushPost', post)
|
||||
},
|
||||
|
||||
@ -48,6 +48,8 @@
|
||||
@removePostFromList="posts = removePostFromList(post, posts)"
|
||||
@pinPost="pinPost(post, refetchPostList)"
|
||||
@unpinPost="unpinPost(post, refetchPostList)"
|
||||
@pinGroupPost="pinGroupPost(post, refetchPostList)"
|
||||
@unpinGroupPost="unpinGroupPost(post, refetchPostList)"
|
||||
@pushPost="pushPost(post, refetchPostList)"
|
||||
@unpushPost="unpushPost(post, refetchPostList)"
|
||||
@toggleObservePost="
|
||||
|
||||
@ -173,6 +173,40 @@ export default () => {
|
||||
}
|
||||
}
|
||||
`,
|
||||
pinGroupPost: gql`
|
||||
mutation ($id: ID!) {
|
||||
pinGroupPost(id: $id) {
|
||||
id
|
||||
title
|
||||
slug
|
||||
content
|
||||
contentExcerpt
|
||||
language
|
||||
pinnedBy {
|
||||
id
|
||||
name
|
||||
role
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
unpinGroupPost: gql`
|
||||
mutation ($id: ID!) {
|
||||
unpinGroupPost(id: $id) {
|
||||
id
|
||||
title
|
||||
slug
|
||||
content
|
||||
contentExcerpt
|
||||
language
|
||||
pinnedBy {
|
||||
id
|
||||
name
|
||||
role
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
pushPost: gql`
|
||||
mutation ($id: ID!) {
|
||||
pushPost(id: $id) {
|
||||
|
||||
@ -52,6 +52,8 @@ export default (i18n) => {
|
||||
name
|
||||
slug
|
||||
groupType
|
||||
myRole
|
||||
currentlyPinnedPostsCount
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -95,6 +97,8 @@ export const filterPosts = (i18n) => {
|
||||
name
|
||||
slug
|
||||
groupType
|
||||
myRole
|
||||
currentlyPinnedPostsCount
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,6 +141,8 @@ export const profilePagePosts = (i18n) => {
|
||||
name
|
||||
slug
|
||||
groupType
|
||||
myRole
|
||||
currentlyPinnedPostsCount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,6 @@ export default {
|
||||
}),
|
||||
},
|
||||
async created() {
|
||||
if (this.isAdmin && this.maxPinnedPosts === 0) await this.fetchPinnedPostsCount()
|
||||
/* if (this.isAdmin && this.maxPinnedPosts === 0) */ await this.fetchPinnedPostsCount()
|
||||
},
|
||||
}
|
||||
|
||||
@ -38,6 +38,36 @@ export default {
|
||||
})
|
||||
.catch((error) => this.$toast.error(error.message))
|
||||
},
|
||||
pinGroupPost(post, refetchPostList = () => {}) {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: PostMutations().pinGroupPost,
|
||||
variables: {
|
||||
id: post.id,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$toast.success(this.$t('post.menu.groupPinnedSuccessfully'))
|
||||
// this.storePinGroupPost()
|
||||
refetchPostList()
|
||||
})
|
||||
.catch((error) => this.$toast.error(error.message))
|
||||
},
|
||||
unpinGroupPost(post, refetchPostList = () => {}) {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: PostMutations().unpinGroupPost,
|
||||
variables: {
|
||||
id: post.id,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$toast.success(this.$t('post.menu.groupUnpinnedSuccessfully'))
|
||||
// this.storeUnpinGroupPost()
|
||||
refetchPostList()
|
||||
})
|
||||
.catch((error) => this.$toast.error(error.message))
|
||||
},
|
||||
pushPost(post, refetchPostList = () => {}) {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
"trunc-html": "^1.1.2",
|
||||
"v-mapbox": "^1.11.2",
|
||||
"v-tooltip": "~2.1.3",
|
||||
"validator": "^13.15.20",
|
||||
"validator": "^13.15.23",
|
||||
"vue-advanced-chat": "^2.0.11",
|
||||
"vue-count-to": "~1.0.13",
|
||||
"vue-infinite-loading": "^2.4.5",
|
||||
|
||||
@ -246,6 +246,8 @@
|
||||
@removePostFromList="posts = removePostFromList(post, posts)"
|
||||
@pinPost="pinPost(post, refetchPostList)"
|
||||
@unpinPost="unpinPost(post, refetchPostList)"
|
||||
@pinGroupPost="pinGroupPost(post, refetchPostList)"
|
||||
@unpinGroupPost="unpinGroupPost(post, refetchPostList)"
|
||||
@pushPost="pushPost(post, refetchPostList)"
|
||||
@unpushPost="unpushPost(post, refetchPostList)"
|
||||
@toggleObservePost="
|
||||
|
||||
@ -116,6 +116,8 @@
|
||||
@removePostFromList="posts = removePostFromList(post, posts)"
|
||||
@pinPost="pinPost(post, refetchPostList)"
|
||||
@unpinPost="unpinPost(post, refetchPostList)"
|
||||
@pinGroupPost="pinGroupPost(post, refetchPostList)"
|
||||
@unpinGroupPost="unpinGroupPost(post, refetchPostList)"
|
||||
@pushPost="pushPost(post, refetchPostList)"
|
||||
@unpushPost="unpushPost(post, refetchPostList)"
|
||||
@toggleObservePost="
|
||||
|
||||
@ -58,6 +58,8 @@
|
||||
:is-owner="isAuthor"
|
||||
@pinPost="pinPost"
|
||||
@unpinPost="unpinPost"
|
||||
@pinGroupPost="pinGroupPost"
|
||||
@unpinGroupPost="unpinGroupPost"
|
||||
@pushPost="pushPost"
|
||||
@unpushPost="unpushPost"
|
||||
@toggleObservePost="toggleObservePost"
|
||||
|
||||
@ -160,6 +160,8 @@
|
||||
@removePostFromList="posts = removePostFromList(post, posts)"
|
||||
@pinPost="pinPost(post, refetchPostList)"
|
||||
@unpinPost="unpinPost(post, refetchPostList)"
|
||||
@pinGroupPost="pinGroupPost(post, refetchPostList)"
|
||||
@unpinGroupPost="unpinGroupPost(post, refetchPostList)"
|
||||
@pushPost="pushPost(post, refetchPostList)"
|
||||
@unpushPost="unpushPost(post, refetchPostList)"
|
||||
@toggleObservePost="
|
||||
|
||||
@ -21389,10 +21389,10 @@ validate-npm-package-license@^3.0.1:
|
||||
spdx-correct "^3.0.0"
|
||||
spdx-expression-parse "^3.0.0"
|
||||
|
||||
validator@^13.15.20:
|
||||
version "13.15.20"
|
||||
resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.20.tgz#054e9238109538a1bf46ae3e1290845a64fa2186"
|
||||
integrity sha512-KxPOq3V2LmfQPP4eqf3Mq/zrT0Dqp2Vmx2Bn285LwVahLc+CsxOM0crBHczm8ijlcjZ0Q5Xd6LW3z3odTPnlrw==
|
||||
validator@^13.15.23:
|
||||
version "13.15.23"
|
||||
resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.23.tgz#59a874f84e4594588e3409ab1edbe64e96d0c62d"
|
||||
integrity sha512-4yoz1kEWqUjzi5zsPbAS/903QXSYp0UOtHsPpp7p9rHAw/W+dkInskAE386Fat3oKRROwO98d9ZB0G4cObgUyw==
|
||||
|
||||
vary@^1, vary@^1.1.2, vary@~1.1.2:
|
||||
version "1.1.2"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user