Merge branch 'master' of github.com:Ocelot-Social-Community/Ocelot-Social

This commit is contained in:
Markus 2023-07-19 09:49:23 +02:00
commit 7dbae3f5c4
13 changed files with 121 additions and 54 deletions

View File

@ -0,0 +1,42 @@
###############################################################################
# A Github repo has max 10 GB of cache.
# https://github.blog/changelog/2021-11-23-github-actions-cache-size-is-now-increased-to-10gb-per-repository/
#
# To avoid "cache thrashing" by their cache eviction policy it is recommended
# to apply a cache cleanup workflow at PR closing to dele cache leftovers of
# the current branch:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
###############################################################################
name: ocelot.social cache cleanup on pr closing
on:
pull_request:
types:
- closed
jobs:
clean-branch-cache:
name: Cleanup branch cache
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,7 +1,7 @@
name: ocelot.social backend test CI
on: [push]
on: push
jobs:
files-changed:
@ -10,7 +10,6 @@ jobs:
outputs:
backend: ${{ steps.changes.outputs.backend }}
docker: ${{ steps.changes.outputs.docker }}
pr-number: ${{ steps.pr.outputs.number }}
steps:
- uses: actions/checkout@v3.3.0
@ -22,10 +21,6 @@ jobs:
filters: .github/file-filters.yml
list-files: shell
- name: Get pr number
id: pr
uses: 8BitJonny/gh-get-current-pr@2.2.0
build_test_neo4j:
name: Docker Build Test - Neo4J
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true'
@ -45,7 +40,7 @@ jobs:
uses: actions/cache/save@v3.3.1
with:
path: /tmp/neo4j.tar
key: backend-neo4j-cache-pr${{ needs.files-changed.outputs.pr-number }}
key: ${{ github.run_id }}-backend-neo4j-cache
build_test_backend:
name: Docker Build Test - Backend
@ -66,7 +61,7 @@ jobs:
uses: actions/cache/save@v3.3.1
with:
path: /tmp/backend.tar
key: backend-cache-pr${{ needs.files-changed.outputs.pr-number }}
key: ${{ github.run_id }}-backend-cache
lint_backend:
name: Lint Backend
@ -95,14 +90,14 @@ jobs:
uses: actions/cache/restore@v3.3.1
with:
path: /tmp/neo4j.tar
key: backend-neo4j-cache-pr${{ needs.files-changed.outputs.pr-number }}
key: ${{ github.run_id }}-backend-neo4j-cache
fail-on-cache-miss: true
- name: Restore Backend cache
uses: actions/cache/restore@v3.3.1
with:
path: /tmp/backend.tar
key: backend-cache-pr${{ needs.files-changed.outputs.pr-number }}
key: ${{ github.run_id }}-backend-cache
fail-on-cache-miss: true
- name: Load Docker Images
@ -129,17 +124,17 @@ jobs:
cleanup:
name: Cleanup
if: always()
if: ${{ needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true' }}
needs: [files-changed, unit_test_backend]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Delete cache
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh extension install actions/gh-actions-cache
set +e
KEY="backend-neo4j-cache-pr${{ needs.files-changed.outputs.pr-number }}"
KEY="${{ github.run_id }}-backend-neo4j-cache"
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
KEY="backend-cache-pr${{ needs.files-changed.outputs.pr-number }}"
KEY="${{ github.run_id }}-backend-cache"
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm

View File

@ -1,12 +1,11 @@
name: ocelot.social end-to-end test CI
on: push
jobs:
docker_preparation:
name: Fullstack test preparation
runs-on: ubuntu-latest
outputs:
pr-number: ${{ steps.pr.outputs.number }}
steps:
- name: Checkout code
uses: actions/checkout@v3
@ -34,10 +33,6 @@ jobs:
yarn build
cd ..
yarn install
- name: Get pr number
id: pr
uses: 8BitJonny/gh-get-current-pr@2.2.0
- name: Cache docker images
id: cache
@ -48,7 +43,7 @@ jobs:
/home/runner/.cache/Cypress
/home/runner/work/Ocelot-Social/Ocelot-Social
/tmp/images/
key: e2e-preparation-cache-pr${{ steps.pr.outputs.number }}
key: ${{ github.run_id }}-e2e-preparation-cache
fullstack_tests:
name: Fullstack tests
@ -71,7 +66,7 @@ jobs:
/home/runner/.cache/Cypress
/home/runner/work/Ocelot-Social/Ocelot-Social
/tmp/images/
key: e2e-preparation-cache-pr${{ needs.docker_preparation.outputs.pr-number }}
key: ${{ github.run_id }}-e2e-preparation-cache
fail-on-cache-miss: true
- name: Boot up test system | docker-compose
@ -104,15 +99,14 @@ jobs:
cleanup:
name: Cleanup
if: always()
needs: [docker_preparation, fullstack_tests]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Delete cache
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh extension install actions/gh-actions-cache
set +e
KEY="e2e-preparation-cache-pr${{ needs.docker_preparation.outputs.pr-number }}"
KEY="${{ github.run_id }}-e2e-preparation-cache"
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm

View File

@ -1,7 +1,7 @@
name: ocelot.social webapp test CI
on: [push]
on: push
jobs:
files-changed:
@ -9,7 +9,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
docker: ${{ steps.changes.outputs.docker }}
pr-number: ${{ steps.pr.outputs.number }}
webapp: ${{ steps.changes.outputs.webapp }}
steps:
- uses: actions/checkout@v3.3.0
@ -22,10 +21,6 @@ jobs:
filters: .github/file-filters.yml
list-files: shell
- name: Get pr number
id: pr
uses: 8BitJonny/gh-get-current-pr@2.2.0
prepare:
name: Prepare
if: needs.files-changed.outputs.webapp == 'true'
@ -58,7 +53,7 @@ jobs:
uses: actions/cache/save@v3.3.1
with:
path: /tmp/webapp.tar
key: webapp-cache-pr${{ needs.files-changed.outputs.pr-number }}
key: ${{ github.run_id }}-webapp-cache
lint_webapp:
name: Lint Webapp
@ -87,7 +82,7 @@ jobs:
uses: actions/cache/restore@v3.3.1
with:
path: /tmp/webapp.tar
key: webapp-cache-pr${{ needs.files-changed.outputs.pr-number }}
key: ${{ github.run_id }}-webapp-cache
- name: Load Docker Image
run: docker load < /tmp/webapp.tar
@ -105,16 +100,16 @@ jobs:
cleanup:
name: Cleanup
if: always()
if: ${{ needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true' }}
needs: [files-changed, unit_test_webapp]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Delete cache
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh extension install actions/gh-actions-cache
set +e
KEY="webapp-cache-pr${{ needs.files-changed.outputs.pr-number }}"
KEY="${{ github.run_id }}-webapp-cache"
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm

View File

@ -89,6 +89,7 @@ export default {
SET room.lastMessageAt = toString(datetime())
RETURN message {
.*,
indexId: toString(message.indexId),
recipientId: recipientUser.id,
senderId: currentUser.id,
username: currentUser.name,

View File

@ -4,7 +4,7 @@
<vue-advanced-chat
:theme="theme"
:current-user-id="currentUser.id"
:room-id="null"
:room-id="!singleRoom ? roomId : null"
:template-actions="JSON.stringify(templatesText)"
:menu-actions="JSON.stringify(menuActions)"
:text-messages="JSON.stringify(textMessages)"
@ -75,8 +75,13 @@ export default {
props: {
theme: {
type: String,
default: 'light',
},
singleRoomId: {
singleRoom: {
type: Boolean,
default: false,
},
roomId: {
type: String,
default: null,
},
@ -144,8 +149,7 @@ export default {
roomsLoaded: false,
roomPage: 0,
roomPageSize: 10,
singleRoom: !!this.singleRoomId || false,
selectedRoom: null,
selectedRoom: this.roomId,
loadingRooms: true,
messagesLoaded: false,
messagePage: 0,
@ -159,7 +163,7 @@ export default {
.mutate({
mutation: createRoom(),
variables: {
userId: this.singleRoomId,
userId: this.roomId,
},
})
.then(({ data: { CreateRoom } }) => {

View File

@ -13,33 +13,40 @@
<client-only>
<modal />
</client-only>
<div v-if="$store.getters['chat/showChat'].showChat" class="chat-modul">
<chat-module
v-on:close-single-room="closeSingleRoom"
:singleRoomId="$store.getters['chat/showChat'].roomID"
/>
<div v-if="getShowChat.showChat" class="chat-modul">
<chat singleRoom :roomId="getShowChat.roomID" @close-single-room="closeSingleRoom" />
</div>
</div>
</template>
<script>
import { mapGetters, mapMutations } from 'vuex'
import seo from '~/mixins/seo'
import mobile from '~/mixins/mobile'
import HeaderMenu from '~/components/HeaderMenu/HeaderMenu'
import Modal from '~/components/Modal'
import PageFooter from '~/components/PageFooter/PageFooter'
import ChatModule from '~/components/Chat/Chat.vue'
import Chat from '~/components/Chat/Chat.vue'
export default {
components: {
HeaderMenu,
Modal,
PageFooter,
ChatModule,
Chat,
},
mixins: [seo, mobile()],
computed: {
...mapGetters({
getShowChat: 'chat/showChat',
}),
},
methods: {
...mapMutations({
showChat: 'chat/SET_OPEN_CHAT',
}),
closeSingleRoom() {
this.$store.commit('chat/SET_OPEN_CHAT', { showChat: false, roomID: null })
this.showChat({ showChat: false, roomID: null })
},
},
beforeCreate() {

View File

@ -91,7 +91,7 @@
},
"roomEmpty": "Keinen Raum selektiert",
"roomsEmpty": "Keine Räume",
"search": "Suche",
"search": "Chat-Räume filtern",
"typeMessage": "Nachricht schreiben",
"userProfileButton": {
"label": "Chat",

View File

@ -91,7 +91,7 @@
},
"roomEmpty": "No room selected",
"roomsEmpty": "No rooms",
"search": "Search",
"search": "Filter chat rooms",
"typeMessage": "Type message",
"userProfileButton": {
"label": "Chat",

View File

@ -75,6 +75,9 @@
}
}
},
"chat": {
"search": "Filtrar salas de chat"
},
"code-of-conduct": {
"subheader": "para la red social de {ORGANIZATION_NAME}"
},

View File

@ -75,6 +75,9 @@
}
}
},
"chat": {
"search": "Filtrer les salons de chat"
},
"code-of-conduct": {
"subheader": "pour le réseau social de {ORGANIZATION_NAME}"
},

View File

@ -1,14 +1,28 @@
<template>
<div>
<ds-heading tag="h1">{{ $t('chat.page.headline') }}</ds-heading>
<chat />
<chat :roomId="getShowChat.showChat ? getShowChat.roomID : null" />
</div>
</template>
<script>
import { mapGetters, mapMutations } from 'vuex'
import Chat from '../components/Chat/Chat.vue'
export default {
components: { Chat },
mounted() {
this.showChat({ showChat: false, roomID: null })
},
computed: {
...mapGetters({
getShowChat: 'chat/showChat',
}),
},
methods: {
...mapMutations({
showChat: 'chat/SET_OPEN_CHAT',
}),
},
}
</script>

View File

@ -85,7 +85,7 @@
content: $t('chat.userProfileButton.tooltip', { name: userName }),
placement: 'bottom-start',
}"
@click="showChat({ showChat: true, roomID: user.id })"
@click="showOrChangeChat(user.id)"
>
{{ $t('chat.userProfileButton.label') }}
</base-button>
@ -182,7 +182,7 @@
<script>
import uniqBy from 'lodash/uniqBy'
import { mapMutations } from 'vuex'
import { mapGetters, mapMutations } from 'vuex'
import postListActions from '~/mixins/postListActions'
import PostTeaser from '~/components/PostTeaser/PostTeaser.vue'
import HcFollowButton from '~/components/Button/FollowButton'
@ -254,6 +254,9 @@ export default {
}
},
computed: {
...mapGetters({
getShowChat: 'chat/showChat',
}),
myProfile() {
return this.$route.params.id === this.$store.getters['auth/user'].id
},
@ -403,6 +406,12 @@ export default {
if (type === 'following') this.followingCount = count
if (type === 'followedBy') this.followedByCount = count
},
async showOrChangeChat(roomID) {
if (this.getShowChat.showChat) {
await this.showChat({ showChat: false, roomID: null })
}
await this.showChat({ showChat: true, roomID })
},
},
apollo: {
profilePagePosts: {