From 0bffede0214b9cdbfad843f6221631dbed34dd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adem=C3=ADlson=20F=2E=20Tonato?= Date: Sat, 24 Oct 2020 11:29:02 +0100 Subject: [PATCH 01/94] feat: add mutation for new functionality (mark-all-as-read) - Add mutation for markAllAsRead (notifications) - Add method to the schema that returns a list of all notifications - Add permissions rules to invoke this method (isAuthenticated) See #2660 --- .../src/middleware/permissionsMiddleware.js | 1 + backend/src/schema/resolvers/notifications.js | 29 +++++++++++++++ backend/src/schema/types/type/NOTIFIED.gql | 1 + webapp/graphql/User.js | 36 +++++++++++++++++++ 4 files changed, 67 insertions(+) diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js index 2c8d7ff63..d3aa7ce9a 100644 --- a/backend/src/middleware/permissionsMiddleware.js +++ b/backend/src/middleware/permissionsMiddleware.js @@ -143,6 +143,7 @@ export default shield( blockUser: isAuthenticated, unblockUser: isAuthenticated, markAsRead: isAuthenticated, + markAllAsRead: isAuthenticated, AddEmailAddress: isAuthenticated, VerifyEmailAddress: isAuthenticated, pinPost: isAdmin, diff --git a/backend/src/schema/resolvers/notifications.js b/backend/src/schema/resolvers/notifications.js index 3c01ddb97..a96181a50 100644 --- a/backend/src/schema/resolvers/notifications.js +++ b/backend/src/schema/resolvers/notifications.js @@ -99,6 +99,35 @@ export default { session.close() } }, + markAllAsRead: async (parent, args, context, resolveInfo) => { + const { user: currentUser } = context + const session = context.driver.session() + const writeTxResultPromise = session.writeTransaction(async (transaction) => { + const markAllNotificationAsReadTransactionResponse = await transaction.run( + ` + MATCH (resource {deleted: false, disabled: false})-[notification:NOTIFIED {read: FALSE}]->(user:User {id:$id}) + SET notification.read = TRUE + WITH user, notification, resource, + [(resource)<-[:WROTE]-(author:User) | author {.*}] AS authors, + [(resource)-[:COMMENTS]->(post:Post)<-[:WROTE]-(author:User) | post{.*, author: properties(author)} ] AS posts + WITH resource, user, notification, authors, posts, + resource {.*, __typename: labels(resource)[0], author: authors[0], post: posts[0]} AS finalResource + RETURN notification {.*, from: finalResource, to: properties(user)} + `, + { id: currentUser.id }, + ) + log(markAllNotificationAsReadTransactionResponse) + return markAllNotificationAsReadTransactionResponse.records.map((record) => + record.get('notification'), + ) + }) + try { + const notifications = await writeTxResultPromise + return notifications + } finally { + session.close() + } + }, }, NOTIFIED: { id: async (parent) => { diff --git a/backend/src/schema/types/type/NOTIFIED.gql b/backend/src/schema/types/type/NOTIFIED.gql index 88ecd3882..864cdea4d 100644 --- a/backend/src/schema/types/type/NOTIFIED.gql +++ b/backend/src/schema/types/type/NOTIFIED.gql @@ -29,6 +29,7 @@ type Query { type Mutation { markAsRead(id: ID!): NOTIFIED + markAllAsRead: [NOTIFIED] } type Subscription { diff --git a/webapp/graphql/User.js b/webapp/graphql/User.js index 3b015dacc..8a0494402 100644 --- a/webapp/graphql/User.js +++ b/webapp/graphql/User.js @@ -136,6 +136,42 @@ export const markAsReadMutation = (i18n) => { ` } +export const markAllAsReadMutation = (i18n) => { + return gql` + ${userFragment} + ${commentFragment} + ${postFragment} + + mutation { + markAllAsRead { + id + read + reason + createdAt + updatedAt + from { + __typename + ... on Post { + ...post + author { + ...user + } + } + ... on Comment { + ...comment + post { + ...post + author { + ...user + } + } + } + } + } + } + ` +} + export const notificationAdded = () => { return gql` ${userFragment} From e37fb535dce43cd5629ee0a900568be5409608be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adem=C3=ADlson=20F=2E=20Tonato?= Date: Sat, 24 Oct 2020 11:54:52 +0100 Subject: [PATCH 02/94] feat: add translations for notifications label (mark all as read) --- webapp/locales/de.json | 1 + webapp/locales/en.json | 1 + webapp/locales/es.json | 1 + webapp/locales/fr.json | 1 + webapp/locales/it.json | 1 + webapp/locales/nl.json | 20 ++++++++++++++++++++ webapp/locales/pt.json | 1 + webapp/locales/ru.json | 1 + 8 files changed, 27 insertions(+) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index adee8921c..8de89bd5c 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -456,6 +456,7 @@ "unread": "Ungelesen" }, "pageLink": "Alle Benachrichtigungen", + "markAllAsRead": "Markiere alle als gelesen", "post": "Beitrag", "reason": { "commented_on_post": "Hat Deinen Beitrag kommentiert …", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 8959e3830..f9e7a43e6 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -456,6 +456,7 @@ "unread": "Unread" }, "pageLink": "All notifications", + "markAllAsRead": "Mark all as read", "post": "Post", "reason": { "commented_on_post": "Commented on your post …", diff --git a/webapp/locales/es.json b/webapp/locales/es.json index 0925687fc..8dc91ac52 100644 --- a/webapp/locales/es.json +++ b/webapp/locales/es.json @@ -449,6 +449,7 @@ "unread": "No leído" }, "pageLink": "Todas las notificaciones", + "markAllAsRead": "Marcar todas como leido", "post": "Contribución", "reason": { "commented_on_post": "Comentó su contribución ...", diff --git a/webapp/locales/fr.json b/webapp/locales/fr.json index e0bcf14e1..0bab5e73d 100644 --- a/webapp/locales/fr.json +++ b/webapp/locales/fr.json @@ -438,6 +438,7 @@ "unread": "Non lu" }, "pageLink": "Toutes les notifications", + "markAllAsRead": "Tout marquer comme lu", "post": "Post", "reason": { "commented_on_post": "Commenté sur votre post…", diff --git a/webapp/locales/it.json b/webapp/locales/it.json index b53b863cc..898a80d63 100644 --- a/webapp/locales/it.json +++ b/webapp/locales/it.json @@ -388,6 +388,7 @@ "unread": "" }, "pageLink": "", + "markAllAsRead": "Segna tutti come letti", "post": "", "reason": { "commented_on_post": "", diff --git a/webapp/locales/nl.json b/webapp/locales/nl.json index 64643133c..35e31591f 100644 --- a/webapp/locales/nl.json +++ b/webapp/locales/nl.json @@ -172,5 +172,25 @@ "taxident": "Identificatienummer voor de belasting over de toegevoegde waarde overeenkomstig § 27 a Wet op de belasting over de toegevoegde waarde (Duitsland).", "termsAc": "Gebruiksvoorwaarden", "tribunal": "registerrechtbank" + }, + "notifications": { + "comment": "", + "content": "", + "empty": "", + "filterLabel": { + "all": "", + "read": "", + "unread": "" + }, + "pageLink": "", + "markAllAsRead": "Markeer alles als gelezen", + "post": "", + "reason": { + "commented_on_post": "", + "mentioned_in_comment": "", + "mentioned_in_post": "" + }, + "title": "", + "user": "" } } diff --git a/webapp/locales/pt.json b/webapp/locales/pt.json index 1a3efeb44..96be89f8e 100644 --- a/webapp/locales/pt.json +++ b/webapp/locales/pt.json @@ -377,6 +377,7 @@ "unread": "Não lido" }, "pageLink": "Todas as notificações", + "markAllAsRead": "Marcar todas como lidas", "post": "Post", "reason": { "commented_on_post": "Comentou no seu post …", diff --git a/webapp/locales/ru.json b/webapp/locales/ru.json index 59928a2c5..bb66aa862 100644 --- a/webapp/locales/ru.json +++ b/webapp/locales/ru.json @@ -449,6 +449,7 @@ "unread": "Непрочитанные" }, "pageLink": "Все уведомления", + "markAllAsRead": "Отметить все как прочитанное", "post": "Пост", "reason": { "commented_on_post": "Комментарий к посту...", From 1df69c90fdd5233d4ab1059a3afb0b95f85db134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adem=C3=ADlson=20F=2E=20Tonato?= Date: Sat, 24 Oct 2020 19:38:45 +0100 Subject: [PATCH 03/94] feat: add tests for mark all as read (backend) --- .../schema/resolvers/notifications.spec.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js index 9d7795dd4..d4805bfc9 100644 --- a/backend/src/schema/resolvers/notifications.spec.js +++ b/backend/src/schema/resolvers/notifications.spec.js @@ -393,4 +393,51 @@ describe('given some notifications', () => { }) }) }) + describe('markAllAsRead', () => { + const markAllAsReadMutation = gql` + mutation { + markAllAsRead { + from { + __typename + ... on Post { + content + } + ... on Comment { + content + } + } + read + createdAt + } + } + ` + describe('unauthenticated', () => { + it('throws authorization error', async () => { + const result = await mutate({ + mutation: markAllAsReadMutation, + }) + expect(result.errors[0]).toHaveProperty('message', 'Not Authorised!') + }) + }) + + describe('authenticated', () => { + beforeEach(async () => { + authenticatedUser = await user.toJson() + }) + + describe('not being notified at all', () => { + beforeEach(async () => { + variables = { + ...variables, + } + }) + + it('returns undefined', async () => { + const response = await mutate({ mutation: markAllAsReadMutation, variables }) + expect(response.data.markAsRead).toEqual(undefined) + expect(response.errors).toBeUndefined() + }) + }) + }) + }) }) From bfe66adaacc9a6bc19976ea7e616f62ac061bb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adem=C3=ADlson=20F=2E=20Tonato?= Date: Sat, 24 Oct 2020 19:40:05 +0100 Subject: [PATCH 04/94] feat: add button to mark all notifications as read on notification menu --- .../NotificationMenu/NotificationMenu.vue | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/webapp/components/NotificationMenu/NotificationMenu.vue b/webapp/components/NotificationMenu/NotificationMenu.vue index ec991f0ef..c53545b91 100644 --- a/webapp/components/NotificationMenu/NotificationMenu.vue +++ b/webapp/components/NotificationMenu/NotificationMenu.vue @@ -16,11 +16,24 @@
- + + + + {{ $t('notifications.pageLink') }} + + + + + {{ $t('notifications.markAllAsRead') }} + + + @@ -28,7 +41,12 @@ From e298a29d8b7b141a249acb729e426ea253d3ee9b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 3 Mar 2023 18:38:41 +0100 Subject: [PATCH 47/94] test remove user from group --- webapp/components/Group/GroupMember.spec.js | 162 +++++++++++++++++++- 1 file changed, 158 insertions(+), 4 deletions(-) diff --git a/webapp/components/Group/GroupMember.spec.js b/webapp/components/Group/GroupMember.spec.js index 0c0b46e43..ef8b96568 100644 --- a/webapp/components/Group/GroupMember.spec.js +++ b/webapp/components/Group/GroupMember.spec.js @@ -1,26 +1,65 @@ import { mount } from '@vue/test-utils' import GroupMember from './GroupMember.vue' +import { changeGroupMemberRoleMutation, removeUserFromGroupMutation } from '~/graphql/groups.js' const localVue = global.localVue const propsData = { - groupId: '', - groupMembers: [], + groupId: 'group-id', + groupMembers: [ + { + slug: 'owner', + id: 'owner', + myRoleInGroup: 'owner', + }, + { + slug: 'user', + id: 'user', + myRoleInGroup: 'usual', + }, + ], } +const stubs = { + 'nuxt-link': true, +} + +const apolloMock = jest + .fn() + .mockRejectedValueOnce({ message: 'Oh no!' }) + .mockResolvedValue({ + data: { + ChangeGroupMemberRole: { + slug: 'user', + id: 'user', + myRoleInGroup: 'admin', + }, + }, + }) + +const toastErrorMock = jest.fn() +const toastSuccessMock = jest.fn() + describe('GroupMember', () => { let wrapper let mocks beforeEach(() => { mocks = { - $t: jest.fn(), + $t: jest.fn((t) => t), + $apollo: { + mutate: apolloMock, + }, + $toast: { + error: toastErrorMock, + success: toastSuccessMock, + }, } }) describe('mount', () => { const Wrapper = () => { - return mount(GroupMember, { propsData, mocks, localVue }) + return mount(GroupMember, { propsData, mocks, localVue, stubs }) } beforeEach(() => { @@ -30,5 +69,120 @@ describe('GroupMember', () => { it('renders', () => { expect(wrapper.findAll('.group-member')).toHaveLength(1) }) + + it('has two users in table', () => { + expect(wrapper.find('tbody').findAll('tr')).toHaveLength(2) + }) + + it('has no modal', () => { + expect(wrapper.find('div.ds-modal-wrapper').exists()).toBe(false) + }) + + describe('change user role', () => { + beforeEach(() => { + jest.clearAllMocks() + wrapper + .find('tbody') + .findAll('tr') + .at(1) + .find('select') + .findAll('option') + .at(2) + .setSelected() + wrapper.find('tbody').findAll('tr').at(1).find('select').trigger('change') + }) + + describe('with server error', () => { + it('toasts an error message', () => { + expect(toastErrorMock).toBeCalledWith('Oh no!') + }) + }) + + describe('with server success', () => { + it('calls the API', () => { + expect(apolloMock).toBeCalledWith({ + mutation: changeGroupMemberRoleMutation(), + variables: { groupId: 'group-id', userId: 'user', roleInGroup: 'admin' }, + }) + }) + + it('toasts a success message', () => { + expect(toastSuccessMock).toBeCalledWith('group.changeMemberRole') + }) + }) + }) + + describe('click remove user', () => { + beforeAll(() => { + apolloMock.mockRejectedValueOnce({ message: 'Oh no!!' }).mockResolvedValue({ + data: { + RemoveUserFromGroup: { + slug: 'user', + id: 'user', + myRoleInGroup: null, + }, + }, + }) + }) + + beforeEach(() => { + wrapper = Wrapper() + wrapper.find('tbody').findAll('tr').at(1).find('button').trigger('click') + }) + + it('opens the modal', () => { + expect(wrapper.find('div.ds-modal-wrapper').isVisible()).toBe(true) + }) + + describe('click on cancel', () => { + beforeEach(() => { + wrapper.find('div.ds-modal-wrapper').find('button.ds-button-ghost').trigger('click') + }) + + it('closes the modal', () => { + expect(wrapper.find('div.ds-modal-wrapper').exists()).toBe(false) + }) + }) + + describe('click on confirm with server error', () => { + beforeEach(() => { + wrapper.find('div.ds-modal-wrapper').find('button.ds-button-primary').trigger('click') + }) + + it('toasts an error message', () => { + expect(toastErrorMock).toBeCalledWith('Oh no!!') + }) + + it('closes the modal', () => { + expect(wrapper.find('div.ds-modal-wrapper').exists()).toBe(false) + }) + }) + + describe('click on confirm with success', () => { + beforeEach(() => { + jest.clearAllMocks() + wrapper.find('div.ds-modal-wrapper').find('button.ds-button-primary').trigger('click') + }) + + it('calls the API', () => { + expect(apolloMock).toBeCalledWith({ + mutation: removeUserFromGroupMutation(), + variables: { groupId: 'group-id', userId: 'user' }, + }) + }) + + it('emits load group members', () => { + expect(wrapper.emitted('loadGroupMembers')).toBeTruthy() + }) + + it('toasts a success message', () => { + expect(toastSuccessMock).toBeCalledWith('group.memberRemoved') + }) + + it('closes the modal', () => { + expect(wrapper.find('div.ds-modal-wrapper').exists()).toBe(false) + }) + }) + }) }) }) From a09960aa541842f125af33fbed81c769e3eb564f Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 3 Mar 2023 20:40:16 +0100 Subject: [PATCH 48/94] Remove gql tag of cypress code. --- .../somebody_reported_the_following_posts.js | 3 +-- cypress/support/commands.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cypress/integration/Moderation.ReportContent/somebody_reported_the_following_posts.js b/cypress/integration/Moderation.ReportContent/somebody_reported_the_following_posts.js index e10c0675f..3ca39e6e6 100644 --- a/cypress/integration/Moderation.ReportContent/somebody_reported_the_following_posts.js +++ b/cypress/integration/Moderation.ReportContent/somebody_reported_the_following_posts.js @@ -1,5 +1,4 @@ import { Given } from "cypress-cucumber-preprocessor/steps"; -import gql from 'graphql-tag' Given('somebody reported the following posts:', table => { table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => { @@ -10,7 +9,7 @@ Given('somebody reported the following posts:', table => { cy.factory() .build('user', {}, submitter) .authenticateAs(submitter) - .mutate(gql`mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) { + .mutate(`mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) { fileReport(resourceId: $resourceId, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription) { reportId } diff --git a/cypress/support/commands.js b/cypress/support/commands.js index de09834e5..7d3738a3d 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -15,11 +15,10 @@ /* globals Cypress cy */ import "cypress-file-upload"; import { GraphQLClient, request } from 'graphql-request' -import gql from 'graphql-tag' import config from '../../backend/src/config' const authenticatedHeaders = (variables) => { - const mutation = gql` + const mutation = ` mutation($email: String!, $password: String!) { login(email: $email, password: $password) } From a724fec8812c374a0c6f91d6c47fc55ac23ef832 Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 3 Mar 2023 21:28:49 +0100 Subject: [PATCH 49/94] Remove unused graphql packages from cypress modul. --- package.json | 5 +---- yarn.lock | 17 ----------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/package.json b/package.json index fad9e207d..ba1e67eec 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,5 @@ "set-value": "^2.0.1", "nan": "2.17.0" }, - "dependencies": { - "graphql": "^16.6.0", - "graphql-tag": "^2.12.6" - } + "dependencies": {} } diff --git a/yarn.lock b/yarn.lock index 149f583f9..51e44fa78 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3317,18 +3317,6 @@ graphql-request@^2.0.0: resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-2.0.0.tgz#8dd12cf1eb2ce0c80f4114fd851741e091134862" integrity sha512-Ww3Ax+G3l2d+mPT8w7HC9LfrKjutnCKtnDq7ZZp2ghVk5IQDjwAk3/arRF1ix17Ky15rm0hrSKVKxRhIVlSuoQ== -graphql-tag@^2.12.6: - version "2.12.6" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" - integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== - dependencies: - tslib "^2.1.0" - -graphql@^16.6.0: - version "16.6.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.6.0.tgz#c2dcffa4649db149f6282af726c8c83f1c7c5fdb" - integrity sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw== - handlebars@^4.7.3: version "4.7.3" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.3.tgz#8ece2797826886cf8082d1726ff21d2a022550ee" @@ -5937,11 +5925,6 @@ tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslib@^2.1.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" - integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== - tty-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" From 99601963f1499ec5f1f06666559e6ee59aa1075e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 5 Mar 2023 14:51:04 +0100 Subject: [PATCH 50/94] cleanup publish workflow for non-branded version --- .github/workflows/publish.yml | 451 ++++++++++++++++------------------ 1 file changed, 207 insertions(+), 244 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 32198dd62..404493d93 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,61 +4,34 @@ on: push: branches: - master - # - 5059-epic-groups # for testing while developing - # template branches in repo - # - template--separate-branch-auto-deployment--5059-epic-groups + - new-ocelot-workflows-publish-deploy jobs: - ############################################################################## - # JOB: PREPARE ############################################################### - ############################################################################## - prepare: - name: Prepare - runs-on: ubuntu-latest - # needs: [nothing] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # TODO: DO STUFF ??? ##################################################### - ########################################################################## - - name: Check translation files - run: | - scripts/translations/sort.sh - scripts/translations/missing-keys.sh - ############################################################################## # JOB: DOCKER BUILD COMMUNITY NEO4J ########################################## ############################################################################## build_production_neo4j: name: Docker Build Production - Neo4J runs-on: ubuntu-latest - needs: [prepare] steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - name: Checkout code uses: actions/checkout@v3 - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_DATE - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - ########################################################################## - # NEO4J ################################################################## - ########################################################################## + - name: Setup env + run: | + echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - name: Neo4J | Build `community` image - run: docker build --target community -t "ocelotsocialnetwork/neo4j-community:latest" -t "ocelotsocialnetwork/neo4j-community:${VERSION}" -t "ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT neo4j/ + run: | + docker build --target community \ + -t "ocelotsocialnetwork/neo4j-community:latest" \ + -t "ocelotsocialnetwork/neo4j-community:${VERSION}" \ + -t "ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + neo4j/ - name: Neo4J | Save docker image run: docker save "ocelotsocialnetwork/neo4j-community" > /tmp/neo4j.tar - name: Upload Artifact @@ -73,32 +46,41 @@ jobs: build_production_backend: name: Docker Build Production - Backend runs-on: ubuntu-latest - needs: [prepare] steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - name: Checkout code uses: actions/checkout@v3 - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_DATE - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - ########################################################################## - # BUILD BACKEND DOCKER IMAGE (production) ################################ - ########################################################################## + - name: Setup env + run: | + echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - name: Backend | Build `production` image run: | - docker build --target base -t "ocelotsocialnetwork/backend:latest-base" -t "ocelotsocialnetwork/backend:${VERSION}-base" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ - docker build --target code -t "ocelotsocialnetwork/backend:latest-code" -t "ocelotsocialnetwork/backend:${VERSION}-code" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ - docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ + docker build --target base \ + -t "ocelotsocialnetwork/backend:latest-base" \ + -t "ocelotsocialnetwork/backend:${VERSION}-base" \ + -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + backend/ + docker build --target code \ + -t "ocelotsocialnetwork/backend:latest-code" \ + -t "ocelotsocialnetwork/backend:${VERSION}-code" \ + -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + backend/ + docker build --target production \ + -t "ocelotsocialnetwork/backend:latest" \ + -t "ocelotsocialnetwork/backend:${VERSION}" \ + -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + backend/ - name: Backend | Save docker image run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact @@ -113,32 +95,41 @@ jobs: build_production_webapp: name: Docker Build Production - WebApp runs-on: ubuntu-latest - needs: [prepare] steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - name: Checkout code uses: actions/checkout@v3 - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_DATE - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - ########################################################################## - # BUILD WEBAPP DOCKER IMAGE (build) ###################################### - ########################################################################## + - name: Setup env + run: | + echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - name: Webapp | Build `production` image run: | - docker build --target base -t "ocelotsocialnetwork/webapp:latest-base" -t "ocelotsocialnetwork/webapp:${VERSION}-base" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - docker build --target code -t "ocelotsocialnetwork/webapp:latest-code" -t "ocelotsocialnetwork/webapp:${VERSION}-code" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + docker build --target base \ + -t "ocelotsocialnetwork/webapp:latest-base" \ + -t "ocelotsocialnetwork/webapp:${VERSION}-base" \ + -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + webapp/ + docker build --target code \ + -t "ocelotsocialnetwork/webapp:latest-code" \ + -t "ocelotsocialnetwork/webapp:${VERSION}-code" \ + -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + webapp/ + docker build --target production \ + -t "ocelotsocialnetwork/webapp:latest" \ + -t "ocelotsocialnetwork/webapp:${VERSION}" \ + -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + webapp/ - name: Webapp | Save docker image run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact @@ -153,32 +144,44 @@ jobs: build_production_maintenance: name: Docker Build Production - Maintenance runs-on: ubuntu-latest - needs: [prepare] steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - name: Checkout code uses: actions/checkout@v3 - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_DATE - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - ########################################################################## - # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# - ########################################################################## + - name: Setup env + run: | + echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - name: Maintenance | Build `production` image run: | - docker build --target base -t "ocelotsocialnetwork/maintenance:latest-base" -t "ocelotsocialnetwork/maintenance:${VERSION}-base" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - docker build --target code -t "ocelotsocialnetwork/maintenance:latest-code" -t "ocelotsocialnetwork/maintenance:${VERSION}-code" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + docker build --target base \ + -t "ocelotsocialnetwork/maintenance:latest-base" \ + -t "ocelotsocialnetwork/maintenance:${VERSION}-base" \ + -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + -f webapp/Dockerfile.maintenance \ + webapp/ + docker build --target code \ + -t "ocelotsocialnetwork/maintenance:latest-code" \ + -t "ocelotsocialnetwork/maintenance:${VERSION}-code" \ + -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + -f webapp/Dockerfile.maintenance \ + webapp/ + docker build --target production \ + -t "ocelotsocialnetwork/maintenance:latest" \ + -t "ocelotsocialnetwork/maintenance:${VERSION}" \ + -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" \ + --build-arg BBUILD_DATE=$BUILD_DATE \ + --build-arg BBUILD_VERSION=$BUILD_VERSION \ + --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ + -f webapp/Dockerfile.maintenance \ + webapp/ - name: Maintenance | Save docker image run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact @@ -198,130 +201,39 @@ jobs: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - name: Download Docker Image (Neo4J) uses: actions/download-artifact@v3 with: name: docker-neo4j-community path: /tmp - - name: Load Docker Image - run: docker load < /tmp/neo4j.tar + - run: docker load < /tmp/neo4j.tar - name: Download Docker Image (Backend) uses: actions/download-artifact@v3 with: name: docker-backend-production path: /tmp - - name: Load Docker Image - run: docker load < /tmp/backend.tar + - run: docker load < /tmp/backend.tar - name: Download Docker Image (WebApp) uses: actions/download-artifact@v3 with: name: docker-webapp-production path: /tmp - - name: Load Docker Image - run: docker load < /tmp/webapp.tar + - run: docker load < /tmp/webapp.tar - name: Download Docker Image (Maintenance) uses: actions/download-artifact@v3 with: name: docker-maintenance-production path: /tmp - - name: Load Docker Image - run: docker load < /tmp/maintenance.tar - ########################################################################## - # Upload ################################################################# - ########################################################################## + - run: docker load < /tmp/maintenance.tar + - name: login to dockerhub run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin - - name: Push neo4j - run: docker push --all-tags ocelotsocialnetwork/neo4j-community - - name: Push backend - run: docker push --all-tags ocelotsocialnetwork/backend - - name: Push webapp - run: docker push --all-tags ocelotsocialnetwork/webapp - - name: Push maintenance - run: docker push --all-tags ocelotsocialnetwork/maintenance - - ############################################################################## - # JOB: KUBERNETES DEPLOY ACTUAL/LATEST VERSION ###################################### - ############################################################################## - kubernetes_deploy: - # see example https://github.com/do-community/example-doctl-action - # see example https://github.com/do-community/example-doctl-action/blob/main/.github/workflows/workflow.yaml - name: Kubernetes deploy of latest version to stage.ocelot.social cluster at DigitalOcean - runs-on: ubuntu-latest - needs: [upload_to_dockerhub] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - ########################################################################## - # Install DigitalOceans doctl and set kubeconfig ######################### - ########################################################################## - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - name: Save DigitalOcean kubeconfig with short-lived credentials - run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cluster-stage-ocelot-social - ########################################################################## - # Deploy new Docker images to DigitalOcean Kubernetes cluster ############ - ########################################################################## - # - name: Deploy 'latest' to DigitalOcean Kubernetes - # run: | - # kubectl -n default set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:latest - # kubectl -n default rollout restart deployment/ocelot-webapp - # kubectl -n default set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:latest - # kubectl -n default rollout restart deployment/ocelot-backend - # kubectl -n default set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:latest - # kubectl -n default rollout restart deployment/ocelot-maintenance - # kubectl -n default set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:latest - # kubectl -n default rollout restart deployment/ocelot-neo4j - - name: Deploy actual version '$BUILD_VERSION' to DigitalOcean Kubernetes + - name: Push images run: | - kubectl -n default set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:$BUILD_VERSION - kubectl -n default rollout restart deployment/ocelot-webapp - kubectl -n default set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:$BUILD_VERSION - kubectl -n default rollout restart deployment/ocelot-backend - kubectl -n default set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:$BUILD_VERSION - kubectl -n default rollout restart deployment/ocelot-maintenance - kubectl -n default set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:$BUILD_VERSION - kubectl -n default rollout restart deployment/ocelot-neo4j - # because this step 'kubectl -n default rollout status deployment/* --timeout=600s' does not work as expected - # and we need the pods to be up again for cleaning and seeding the Neo4j database and the backend. - # !!! this is not a perfect solution !!! - # deployments are regularly up again after 3 minutes and 10 seconds - - name: Sleep for 4 minutes, means 240 seconds - run: sleep 240s - shell: bash - - name: Verify deployment and wait for the pods of each deployment to get ready for cleaning and seeding of the database - run: | - kubectl -n default rollout status deployment/ocelot-backend --timeout=600s - kubectl -n default rollout status deployment/ocelot-neo4j --timeout=600s - kubectl -n default rollout status deployment/ocelot-maintenance --timeout=600s - kubectl -n default rollout status deployment/ocelot-webapp --timeout=600s - - name: Run migrations for Neo4j database via backend for staging - run: | - kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "yarn prod:migrate up" - - name: Reset and seed Neo4j database via backend for staging - # db cleaning and seeding is only possible in production if env 'PRODUCTION_DB_CLEAN_ALLOW=true' is set in deployment - run: | - kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "node --experimental-repl-await dist/db/clean.js && node --experimental-repl-await dist/db/seed.js" + docker push --all-tags ocelotsocialnetwork/neo4j-community + docker push --all-tags ocelotsocialnetwork/backend + docker push --all-tags ocelotsocialnetwork/webapp + docker push --all-tags ocelotsocialnetwork/maintenance ############################################################################## # JOB: GITHUB TAG LATEST VERSION ############################################# @@ -331,39 +243,16 @@ jobs: runs-on: ubuntu-latest needs: [upload_to_dockerhub] steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 # Fetch full History for changelog - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_DATE - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - ########################################################################## - # Push version tag to GitHub ############################################# - ########################################################################## - # TODO: this will error on duplicate - #- name: package-version-to-git-tag - # uses: pkgdeps/git-tag-action@v2 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # github_repo: ${{ github.repository }} - # version: ${{ env.VERSION }} - # git_commit_sha: ${{ github.sha }} - # git_tag_prefix: "v" - ########################################################################## - # Push build tag to GitHub ############################################### - ########################################################################## + - name: Setup env + run: | + echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - name: package-version-to-git-tag + build number uses: pkgdeps/git-tag-action@v2 with: @@ -371,14 +260,13 @@ jobs: github_repo: ${{ github.repository }} version: ${{ env.BUILD_VERSION }} git_commit_sha: ${{ github.sha }} - git_tag_prefix: "b" - ########################################################################## - # Push release tag to GitHub ############################################# - ########################################################################## - - name: yarn install - run: yarn install - - name: generate changelog - run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only + #git_tag_prefix: "b" + # TODO + git_tag_prefix: "test" + - name: Generate changelog + run: | + yarn install + yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only - name: package-version-to-git-release continue-on-error: true # Will fail if tag exists id: create_release @@ -391,3 +279,78 @@ jobs: body_path: ./CHANGELOG.md draft: false prerelease: false + + # ############################################################################## + # # JOB: KUBERNETES DEPLOY ACTUAL/LATEST VERSION ###################################### + # ############################################################################## + # kubernetes_deploy: + # # see example https://github.com/do-community/example-doctl-action + # # see example https://github.com/do-community/example-doctl-action/blob/main/.github/workflows/workflow.yaml + # name: Kubernetes deploy of latest version to stage.ocelot.social cluster at DigitalOcean + # runs-on: ubuntu-latest + # needs: [upload_to_dockerhub] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # SET ENVS ############################################################### + # ########################################################################## + # - name: ENV - VERSION + # run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + # - name: ENV - BUILD_VERSION + # run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + # ########################################################################## + # # Install DigitalOceans doctl and set kubeconfig ######################### + # ########################################################################## + # - name: Install doctl + # uses: digitalocean/action-doctl@v2 + # with: + # token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} + # - name: Save DigitalOcean kubeconfig with short-lived credentials + # run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cluster-stage-ocelot-social + # ########################################################################## + # # Deploy new Docker images to DigitalOcean Kubernetes cluster ############ + # ########################################################################## + # # - name: Deploy 'latest' to DigitalOcean Kubernetes + # # run: | + # # kubectl -n default set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:latest + # # kubectl -n default rollout restart deployment/ocelot-webapp + # # kubectl -n default set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:latest + # # kubectl -n default rollout restart deployment/ocelot-backend + # # kubectl -n default set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:latest + # # kubectl -n default rollout restart deployment/ocelot-maintenance + # # kubectl -n default set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:latest + # # kubectl -n default rollout restart deployment/ocelot-neo4j + # - name: Deploy actual version '$BUILD_VERSION' to DigitalOcean Kubernetes + # run: | + # kubectl -n default set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:$BUILD_VERSION + # kubectl -n default rollout restart deployment/ocelot-webapp + # kubectl -n default set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:$BUILD_VERSION + # kubectl -n default rollout restart deployment/ocelot-backend + # kubectl -n default set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:$BUILD_VERSION + # kubectl -n default rollout restart deployment/ocelot-maintenance + # kubectl -n default set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:$BUILD_VERSION + # kubectl -n default rollout restart deployment/ocelot-neo4j + # # because this step 'kubectl -n default rollout status deployment/* --timeout=600s' does not work as expected + # # and we need the pods to be up again for cleaning and seeding the Neo4j database and the backend. + # # !!! this is not a perfect solution !!! + # # deployments are regularly up again after 3 minutes and 10 seconds + # - name: Sleep for 4 minutes, means 240 seconds + # run: sleep 240s + # shell: bash + # - name: Verify deployment and wait for the pods of each deployment to get ready for cleaning and seeding of the database + # run: | + # kubectl -n default rollout status deployment/ocelot-backend --timeout=600s + # kubectl -n default rollout status deployment/ocelot-neo4j --timeout=600s + # kubectl -n default rollout status deployment/ocelot-maintenance --timeout=600s + # kubectl -n default rollout status deployment/ocelot-webapp --timeout=600s + # - name: Run migrations for Neo4j database via backend for staging + # run: | + # kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "yarn prod:migrate up" + # - name: Reset and seed Neo4j database via backend for staging + # # db cleaning and seeding is only possible in production if env 'PRODUCTION_DB_CLEAN_ALLOW=true' is set in deployment + # run: | + # kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "node --experimental-repl-await dist/db/clean.js && node --experimental-repl-await dist/db/seed.js" \ No newline at end of file From d271ff37604be4a306e65774124cc086fbe85625 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 5 Mar 2023 15:00:10 +0100 Subject: [PATCH 51/94] use long version of docker build flags --- .github/workflows/publish.yml | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 404493d93..519875507 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,9 +25,9 @@ jobs: - name: Neo4J | Build `community` image run: | docker build --target community \ - -t "ocelotsocialnetwork/neo4j-community:latest" \ - -t "ocelotsocialnetwork/neo4j-community:${VERSION}" \ - -t "ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}" \ + --tag "ocelotsocialnetwork/neo4j-community:latest" \ + --tag "ocelotsocialnetwork/neo4j-community:${VERSION}" \ + --tag "ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ @@ -58,25 +58,25 @@ jobs: - name: Backend | Build `production` image run: | docker build --target base \ - -t "ocelotsocialnetwork/backend:latest-base" \ - -t "ocelotsocialnetwork/backend:${VERSION}-base" \ - -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" \ + --tag "ocelotsocialnetwork/backend:latest-base" \ + --tag "ocelotsocialnetwork/backend:${VERSION}-base" \ + --tag "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ backend/ docker build --target code \ - -t "ocelotsocialnetwork/backend:latest-code" \ - -t "ocelotsocialnetwork/backend:${VERSION}-code" \ - -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" \ + --tag "ocelotsocialnetwork/backend:latest-code" \ + --tag "ocelotsocialnetwork/backend:${VERSION}-code" \ + --tag "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ backend/ docker build --target production \ - -t "ocelotsocialnetwork/backend:latest" \ - -t "ocelotsocialnetwork/backend:${VERSION}" \ - -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" \ + --tag "ocelotsocialnetwork/backend:latest" \ + --tag "ocelotsocialnetwork/backend:${VERSION}" \ + --tag "ocelotsocialnetwork/backend:${BUILD_VERSION}" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ @@ -107,25 +107,25 @@ jobs: - name: Webapp | Build `production` image run: | docker build --target base \ - -t "ocelotsocialnetwork/webapp:latest-base" \ - -t "ocelotsocialnetwork/webapp:${VERSION}-base" \ - -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" \ + --tag "ocelotsocialnetwork/webapp:latest-base" \ + --tag "ocelotsocialnetwork/webapp:${VERSION}-base" \ + --tag "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ webapp/ docker build --target code \ - -t "ocelotsocialnetwork/webapp:latest-code" \ - -t "ocelotsocialnetwork/webapp:${VERSION}-code" \ - -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" \ + --tag "ocelotsocialnetwork/webapp:latest-code" \ + --tag "ocelotsocialnetwork/webapp:${VERSION}-code" \ + --tag "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ webapp/ docker build --target production \ - -t "ocelotsocialnetwork/webapp:latest" \ - -t "ocelotsocialnetwork/webapp:${VERSION}" \ - -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" \ + --tag "ocelotsocialnetwork/webapp:latest" \ + --tag "ocelotsocialnetwork/webapp:${VERSION}" \ + --tag "ocelotsocialnetwork/webapp:${BUILD_VERSION}" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ @@ -156,27 +156,27 @@ jobs: - name: Maintenance | Build `production` image run: | docker build --target base \ - -t "ocelotsocialnetwork/maintenance:latest-base" \ - -t "ocelotsocialnetwork/maintenance:${VERSION}-base" \ - -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" \ + --tag "ocelotsocialnetwork/maintenance:latest-base" \ + --tag "ocelotsocialnetwork/maintenance:${VERSION}-base" \ + --tag "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ -f webapp/Dockerfile.maintenance \ webapp/ docker build --target code \ - -t "ocelotsocialnetwork/maintenance:latest-code" \ - -t "ocelotsocialnetwork/maintenance:${VERSION}-code" \ - -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" \ + --tag "ocelotsocialnetwork/maintenance:latest-code" \ + --tag "ocelotsocialnetwork/maintenance:${VERSION}-code" \ + --tag "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ -f webapp/Dockerfile.maintenance \ webapp/ docker build --target production \ - -t "ocelotsocialnetwork/maintenance:latest" \ - -t "ocelotsocialnetwork/maintenance:${VERSION}" \ - -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" \ + --tag "ocelotsocialnetwork/maintenance:latest" \ + --tag "ocelotsocialnetwork/maintenance:${VERSION}" \ + --tag "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ From 71dc31d926a561f928c74ac9146963412053a885 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 5 Mar 2023 15:02:10 +0100 Subject: [PATCH 52/94] try different quotations --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 519875507..3660d3b5a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,9 +25,9 @@ jobs: - name: Neo4J | Build `community` image run: | docker build --target community \ - --tag "ocelotsocialnetwork/neo4j-community:latest" \ - --tag "ocelotsocialnetwork/neo4j-community:${VERSION}" \ - --tag "ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}" \ + --tag 'ocelotsocialnetwork/neo4j-community:latest' \ + --tag 'ocelotsocialnetwork/neo4j-community:${VERSION}'' \ + --tag 'ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}'' \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ From 62e3b3042790b41ee16dc40b1aac168188e58aee Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 5 Mar 2023 15:03:57 +0100 Subject: [PATCH 53/94] no quotations --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3660d3b5a..9d10bbbbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,9 +25,9 @@ jobs: - name: Neo4J | Build `community` image run: | docker build --target community \ - --tag 'ocelotsocialnetwork/neo4j-community:latest' \ - --tag 'ocelotsocialnetwork/neo4j-community:${VERSION}'' \ - --tag 'ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}'' \ + --tag ocelotsocialnetwork/neo4j-community:latest \ + --tag ocelotsocialnetwork/neo4j-community:${VERSION} \ + --tag ocelotsocialnetwork/neo4j-community:${BUILD_VERSION} \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ From 540c3bd9c40c3b42267baa9b6f4601a2d1066367 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 5 Mar 2023 15:07:32 +0100 Subject: [PATCH 54/94] referencing envs in a second step --- .github/workflows/publish.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9d10bbbbd..3b7fdaf60 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,14 +20,14 @@ jobs: run: | echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: Neo4J | Build `community` image run: | docker build --target community \ - --tag ocelotsocialnetwork/neo4j-community:latest \ - --tag ocelotsocialnetwork/neo4j-community:${VERSION} \ - --tag ocelotsocialnetwork/neo4j-community:${BUILD_VERSION} \ + --tag "ocelotsocialnetwork/neo4j-community:latest" \ + --tag "ocelotsocialnetwork/neo4j-community:${VERSION}" \ + --tag "ocelotsocialnetwork/neo4j-community:${BUILD_VERSION}" \ --build-arg BBUILD_DATE=$BUILD_DATE \ --build-arg BBUILD_VERSION=$BUILD_VERSION \ --build-arg BBUILD_COMMIT=$BUILD_COMMIT \ @@ -53,8 +53,8 @@ jobs: run: | echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: Backend | Build `production` image run: | docker build --target base \ @@ -102,8 +102,8 @@ jobs: run: | echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: Webapp | Build `production` image run: | docker build --target base \ @@ -151,8 +151,8 @@ jobs: run: | echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: Maintenance | Build `production` image run: | docker build --target base \ @@ -251,8 +251,8 @@ jobs: run: | echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: package-version-to-git-tag + build number uses: pkgdeps/git-tag-action@v2 with: From baedff2f9475514d181612757450891db813cebf Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 6 Mar 2023 10:53:23 +0100 Subject: [PATCH 55/94] use trigger to call other workflow --- .github/workflows/publish-branded.yml | 25 ++++++------------------- .github/workflows/publish.yml | 22 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish-branded.yml b/.github/workflows/publish-branded.yml index 2877aa213..e9dc62751 100644 --- a/.github/workflows/publish-branded.yml +++ b/.github/workflows/publish-branded.yml @@ -1,9 +1,7 @@ -name: ocelot.social publish branded CI - +name: publish-branded on: - push: - branches: - - master + repository_dispatch: + types: [trigger_build_success] jobs: build_branded: name: Docker Build Branded @@ -11,7 +9,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - + with: + ref: ${{ github.event.client_payload.ref }} - name: Build branded images run: | deployment/scripts/branded-images.build.sh @@ -45,9 +44,6 @@ jobs: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Download Docker Image (Backend) uses: actions/download-artifact@v2 with: @@ -73,13 +69,4 @@ jobs: run: docker load < /tmp/maintenance-branded.tar - name: Upload to dockerhub - run: deployment/scripts/branded-images.upload.sh -# - name: login to dockerhub -# run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin -# -# - name: Push Backend -# run: docker push --all-tags ocelotsocialnetwork/backend-branded -# - name: Push Webapp -# run: docker push --all-tags ocelotsocialnetwork/webapp-branded -# - name: Push Maintenance -# run: docker push --all-tags ocelotsocialnetwork/maintenance-branded \ No newline at end of file + run: deployment/scripts/branded-images.upload.sh \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3b7fdaf60..f9d3f0ecb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: ocelot.social publish CI +name: publish on: push: @@ -280,6 +280,26 @@ jobs: draft: false prerelease: false + build_trigger: + name: Trigger successful build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch full History for changelog + - name: Setup env + run: | + echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v1 + with: + event-type: trigger_build_success + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}' + # ############################################################################## # # JOB: KUBERNETES DEPLOY ACTUAL/LATEST VERSION ###################################### # ############################################################################## From 8e407917736d3b75cc1786abb49a6015e46cbe3c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 6 Mar 2023 11:01:25 +0100 Subject: [PATCH 56/94] pat token, dependance on compylete publish --- .github/workflows/publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f9d3f0ecb..28b39ad62 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -283,6 +283,7 @@ jobs: build_trigger: name: Trigger successful build runs-on: ubuntu-latest + needs: [github_tag] steps: - name: Checkout code uses: actions/checkout@v3 @@ -297,6 +298,7 @@ jobs: - name: Repository Dispatch uses: peter-evans/repository-dispatch@v1 with: + token: ${{ secrets.PAT }} event-type: trigger_build_success client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}' From 0f4e609667a23860f1d08d11774869c22c14a94c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 6 Mar 2023 11:06:08 +0100 Subject: [PATCH 57/94] exclude dependabot from pr title linting --- .github/workflows/lint_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml index 8ef9750a4..5a06f9144 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/lint_pr.yml @@ -12,6 +12,7 @@ jobs: main: name: Validate PR title runs-on: ubuntu-latest + if: ${{ github.actor != 'dependabot[bot]' }} steps: - uses: amannn/action-semantic-pull-request@v5 env: From 9bc95908aec377fa9a52cc5ad309bb708d787a62 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 6 Mar 2023 11:39:39 +0100 Subject: [PATCH 58/94] use github token explicitly, use explicit ocelot version in brad --- .github/workflows/publish-branded.yml | 2 ++ .github/workflows/publish.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-branded.yml b/.github/workflows/publish-branded.yml index e9dc62751..90bd0607e 100644 --- a/.github/workflows/publish-branded.yml +++ b/.github/workflows/publish-branded.yml @@ -11,6 +11,8 @@ jobs: uses: actions/checkout@v2 with: ref: ${{ github.event.client_payload.ref }} + - name: Setup env + run: echo "OCELOT_VERSION=${{ github.event.client_payload.BUILD_VERSION }}" >> $GITHUB_ENV - name: Build branded images run: | deployment/scripts/branded-images.build.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 28b39ad62..67ae4d527 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -298,7 +298,7 @@ jobs: - name: Repository Dispatch uses: peter-evans/repository-dispatch@v1 with: - token: ${{ secrets.PAT }} + token: ${{ github.token }} event-type: trigger_build_success client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}' From 4bfba1983f81e6e0a7dfcfc4ba7a49728568d5c5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 6 Mar 2023 12:37:20 +0100 Subject: [PATCH 59/94] define repo and refacor event name --- .github/workflows/publish-branded.yml | 2 +- .github/workflows/publish.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-branded.yml b/.github/workflows/publish-branded.yml index 90bd0607e..a404453e6 100644 --- a/.github/workflows/publish-branded.yml +++ b/.github/workflows/publish-branded.yml @@ -1,7 +1,7 @@ name: publish-branded on: repository_dispatch: - types: [trigger_build_success] + types: [trigger-build-success] jobs: build_branded: name: Docker Build Branded diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 67ae4d527..0fa7ef040 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -299,7 +299,8 @@ jobs: uses: peter-evans/repository-dispatch@v1 with: token: ${{ github.token }} - event-type: trigger_build_success + event-type: trigger-build-success + repository: ${{ github.repository }} client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}' # ############################################################################## From 63e519428c2298e52024bb96a193b5e9764ecece Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 6 Mar 2023 12:38:17 +0100 Subject: [PATCH 60/94] publish only on master & build tag prefix --- .github/workflows/publish.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0fa7ef040..01256d719 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,7 +4,6 @@ on: push: branches: - master - - new-ocelot-workflows-publish-deploy jobs: ############################################################################## @@ -260,9 +259,7 @@ jobs: github_repo: ${{ github.repository }} version: ${{ env.BUILD_VERSION }} git_commit_sha: ${{ github.sha }} - #git_tag_prefix: "b" - # TODO - git_tag_prefix: "test" + git_tag_prefix: "b" - name: Generate changelog run: | yarn install From 682a7d9d50acf517ffd07211b4c2a62c88cdcaa0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 6 Mar 2023 13:26:50 +0100 Subject: [PATCH 61/94] lint pr only when there is a pullrequest not on every push --- .github/workflows/lint_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml index 5a06f9144..5a8bb662f 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/lint_pr.yml @@ -1,7 +1,6 @@ name: "ocelot.social lint pull request CI" on: - pull_request: pull_request_target: types: - opened From 6d09dbcf08c4d6be28bb7eae443eb64389dfbe4d Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 13:47:14 +0100 Subject: [PATCH 62/94] Update webapp/locales/de.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- webapp/locales/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index aebf8d5cd..67ba5aaa4 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -452,7 +452,7 @@ "message": "Eine Gruppe zu verlassen ist möglicherweise nicht rückgängig zu machen!
Gruppe „{name}“ verlassen!", "title": "Möchtest du wirklich die Gruppe verlassen?" }, - "memberRemoved": "Nutzer „{name}“ wurde aus der Gruppe entfernt", + "memberRemoved": "Nutzer „{name}“ wurde aus der Gruppe entfernt!", "members": "Mitglieder", "membersAdministrationList": { "avatar": "Avatar", From eb0bc971ecbe6129dc945ae7d6ce99073b77e521 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 13:47:28 +0100 Subject: [PATCH 63/94] Update webapp/locales/en.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- webapp/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 8f82b4578..31784ac2e 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -452,7 +452,7 @@ "message": "Leaving a group may be irreversible!
Leave group “{name}”!", "title": "Do you really want to leave the group?" }, - "memberRemoved": "User “{name}” was removed from group", + "memberRemoved": "User “{name}” was removed from group!", "members": "Members", "membersAdministrationList": { "avatar": "Avatar", From db8ad8897e542aad48a461fc26baa5645f6495e4 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 14:11:55 +0100 Subject: [PATCH 64/94] same cypher for removeUserFromGroup and leaveGroup, adjust tests, admin cannot remove users fro group --- .../src/middleware/permissionsMiddleware.js | 5 +- backend/src/schema/resolvers/groups.js | 65 ++++++++----------- backend/src/schema/resolvers/groups.spec.js | 21 ++++++ .../schema/resolvers/postsInGroups.spec.js | 32 +++++++-- 4 files changed, 74 insertions(+), 49 deletions(-) diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js index 2e04dd4a0..00a34f9ab 100644 --- a/backend/src/middleware/permissionsMiddleware.js +++ b/backend/src/middleware/permissionsMiddleware.js @@ -280,10 +280,7 @@ const canRemoveUserFromGroup = rule({ try { const { currentUserRole, userRole } = await readTxPromise return ( - currentUserRole && - ['admin', 'owner'].includes(currentUserRole) && - userRole && - userRole !== 'owner' + currentUserRole && ['owner'].includes(currentUserRole) && userRole && userRole !== 'owner' ) } catch (error) { throw new Error(error) diff --git a/backend/src/schema/resolvers/groups.js b/backend/src/schema/resolvers/groups.js index 8ec0e9a4b..4a13dcc88 100644 --- a/backend/src/schema/resolvers/groups.js +++ b/backend/src/schema/resolvers/groups.js @@ -295,25 +295,8 @@ export default { LeaveGroup: async (_parent, params, context, _resolveInfo) => { const { groupId, userId } = params const session = context.driver.session() - const writeTxResultPromise = session.writeTransaction(async (transaction) => { - const leaveGroupCypher = ` - MATCH (member:User {id: $userId})-[membership:MEMBER_OF]->(group:Group {id: $groupId}) - DELETE membership - WITH member, group - OPTIONAL MATCH (p:Post)-[:IN]->(group) - WHERE NOT group.groupType = 'public' - WITH member, group, collect(p) AS posts - FOREACH (post IN posts | - MERGE (member)-[:CANNOT_SEE]->(post)) - RETURN member {.*, myRoleInGroup: NULL} - ` - - const transactionResponse = await transaction.run(leaveGroupCypher, { groupId, userId }) - const [member] = await transactionResponse.records.map((record) => record.get('member')) - return member - }) try { - return await writeTxResultPromise + return await removeUserFromGroupWriteTxResultPromise(session, groupId, userId) } catch (error) { throw new Error(error) } finally { @@ -371,28 +354,8 @@ export default { RemoveUserFromGroup: async (_parent, params, context, _resolveInfo) => { const { groupId, userId } = params const session = context.driver.session() - const writeTxResultPromise = session.writeTransaction(async (transaction) => { - const removeUserFromGroupCypher = ` - MATCH (member:User {id: $userId})-[membership:MEMBER_OF]->(group:Group {id: $groupId}) - DELETE membership - WITH member AS user, group - OPTIONAL MATCH (u:User)-[:WROTE]->(p:Post)-[:IN]->(group) - WHERE NOT u.id = $userId - WITH user, collect(p) AS posts - FOREACH (post IN posts | - MERGE (user)-[:CANNOT_SEE]->(post)) - RETURN user {.*, myRoleInGroup: null}` - - const transactionResponse = await transaction.run(removeUserFromGroupCypher, { - groupId, - userId, - }) - - const [user] = await transactionResponse.records.map((record) => record.get('user')) - return user - }) try { - return await writeTxResultPromise + return await removeUserFromGroupWriteTxResultPromise(session, groupId, userId) } catch (error) { throw new Error(error) } finally { @@ -414,3 +377,27 @@ export default { }), }, } + +const removeUserFromGroupWriteTxResultPromise = async (session, groupId, userId) => { + return session.writeTransaction(async (transaction) => { + const removeUserFromGroupCypher = ` + MATCH (user:User {id: $userId})-[membership:MEMBER_OF]->(group:Group {id: $groupId}) + DELETE membership + WITH user, group + OPTIONAL MATCH (author:User)-[:WROTE]->(p:Post)-[:IN]->(group) + WHERE NOT group.groupType = 'public' + AND NOT author.id = $userId + WITH user, collect(p) AS posts + FOREACH (post IN posts | + MERGE (user)-[:CANNOT_SEE]->(post)) + RETURN user {.*, myRoleInGroup: NULL} + ` + + const transactionResponse = await transaction.run(removeUserFromGroupCypher, { + groupId, + userId, + }) + const [user] = await transactionResponse.records.map((record) => record.get('user')) + return user + }) +} diff --git a/backend/src/schema/resolvers/groups.spec.js b/backend/src/schema/resolvers/groups.spec.js index 1142b0b32..13291383d 100644 --- a/backend/src/schema/resolvers/groups.spec.js +++ b/backend/src/schema/resolvers/groups.spec.js @@ -3076,6 +3076,26 @@ describe('in mode', () => { }) }) + it('throws an error', async () => { + authenticatedUser = await usualMemberUser.toJson() + await expect( + mutate({ + mutation: removeUserFromGroupMutation(), + variables: { + groupId: 'hidden-group', + userId: 'admin-member-user', + }, + }), + ).resolves.toMatchObject({ + errors: expect.arrayContaining([ + expect.objectContaining({ + message: 'Not Authorized!', + }), + ]), + }) + }) + + /* it('removes the user from the group', async () => { await expect( mutate({ @@ -3131,6 +3151,7 @@ describe('in mode', () => { ]), }) }) + */ }) }) }) diff --git a/backend/src/schema/resolvers/postsInGroups.spec.js b/backend/src/schema/resolvers/postsInGroups.spec.js index 5bf5820f0..404c3f25f 100644 --- a/backend/src/schema/resolvers/postsInGroups.spec.js +++ b/backend/src/schema/resolvers/postsInGroups.spec.js @@ -1524,9 +1524,9 @@ describe('Posts in Groups', () => { }) }) - it('does not show the posts of the closed group anymore', async () => { + it('stil shows the posts of the closed group', async () => { const result = await query({ query: filterPosts(), variables: {} }) - expect(result.data.Post).toHaveLength(3) + expect(result.data.Post).toHaveLength(4) expect(result).toMatchObject({ data: { Post: expect.arrayContaining([ @@ -1540,6 +1540,11 @@ describe('Posts in Groups', () => { title: 'A post without a group', content: 'I am a user who does not belong to a group yet.', }, + { + id: 'post-to-closed-group', + title: 'A post to a closed group', + content: 'I am posting into a closed group as a member of the group', + }, { id: 'post-to-hidden-group', title: 'A post to a hidden group', @@ -1564,9 +1569,9 @@ describe('Posts in Groups', () => { }) }) - it('does only show the public posts', async () => { + it('still shows the post of the hidden group', async () => { const result = await query({ query: filterPosts(), variables: {} }) - expect(result.data.Post).toHaveLength(2) + expect(result.data.Post).toHaveLength(4) expect(result).toMatchObject({ data: { Post: expect.arrayContaining([ @@ -1580,6 +1585,16 @@ describe('Posts in Groups', () => { title: 'A post without a group', content: 'I am a user who does not belong to a group yet.', }, + { + id: 'post-to-closed-group', + title: 'A post to a closed group', + content: 'I am posting into a closed group as a member of the group', + }, + { + id: 'post-to-hidden-group', + title: 'A post to a hidden group', + content: 'I am posting into a hidden group as a member of the group', + }, ]), }, errors: undefined, @@ -1603,9 +1618,9 @@ describe('Posts in Groups', () => { authenticatedUser = await allGroupsUser.toJson() }) - it('does not show the posts of the closed group', async () => { + it('shows the posts of the closed group', async () => { const result = await query({ query: filterPosts(), variables: {} }) - expect(result.data.Post).toHaveLength(3) + expect(result.data.Post).toHaveLength(4) expect(result).toMatchObject({ data: { Post: expect.arrayContaining([ @@ -1624,6 +1639,11 @@ describe('Posts in Groups', () => { title: 'A post to a closed group', content: 'I am posting into a closed group as a member of the group', }, + { + id: 'post-to-hidden-group', + title: 'A post to a hidden group', + content: 'I am posting into a hidden group as a member of the group', + }, ]), }, errors: undefined, From 57f9b0d49015404da2e1066cb131d7060e03afaa Mon Sep 17 00:00:00 2001 From: sushidave Date: Mon, 6 Mar 2023 14:59:09 +0100 Subject: [PATCH 65/94] Update README.md Add general information --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f0688f820..8d483dc79 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,71 @@ At the same time, it should be possible in the future to link these networks wit In other words, we are interested in a network of networks and in keeping the data as close as possible to the user and the operator they trusts. -## Introduction +## Features + +Ocelot.social networks feature: +* user accounts +* user roles +* posts and comments +* groups +* maps +* search +* filters +* ...and more. + +Check out the [full feature list](/wiki/en:FAQ#what-are-the-features). + +## Screenshots + +Post feed + +Check out more screenshots [here](/wiki/en:Screenshots). + +## User Guide and Frequently Asked Questions + +In the [wiki](/wiki) you can find more information. + +* [User Guide](/wiki/en:User-Guide) +* [Frequently Asked Questions](/wiki/en:FAQ) + +## Demo + +Try out our live demo network, see [here](#live-demo-and-developer-logins). + +## Help us + +If you're wondering how could you help, there are plenty of ways, e.g.: + +* Spread the good word about ocelot.social to make it more popular: + * Add the link [ocelot.social](https://ocelot.social) to your website. + * Give ocelot.social a Like at https://alternativeto.net/software/ocelot-social/. + * Star our project on GitHub at https://github.com/Ocelot-Social-Community/Ocelot-Social/. + * Promote it on your social networks. + * Tell your friends about it by word-of-mouth. + * Write a press article on ocelot.social or contact the editorial office of your local newspage or radio station. +* Take a [good first issue](https://github.com/Ocelot-Social-Community/Ocelot-Social/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or issues that need help. Make sure to read [CONTRIBUTING.md](/CONTRIBUTING.md) first though. +* Testing and [reporting](/issues/new/choose) bugs. +* Translating: Please [contact us](#contact). +* Reviewing and testing pull requests. + +## Donate + +Your donation is very welcome and helps to enhance and improve the network. This software is mostly developped and maintained by the association [busFaktor() e.V.](https://www.busfaktor.org/en). Please support us with a [donation](https://www.busfaktor.org/en/donations) to busFaktor() e.V.. Thanks a lot! ❤️ + +## Contact + +Are you interested in operating your own ocelot.social network or becoming a user? Please contact us here: +* [hello@ocelot.social](mailto:hello@ocelot.social) +* [Discord](https://discord.com/invite/DFSjPaX) + +## For Developers and Contributors + +### Introduction Have a look into our short video: [ocelot.social - GitHub - Developer Welcome - Tutorial (english)](https://www.youtube.com/watch?v=gZSL6KvBIiY&list=PLFMD5liPP01kbuReHxYXxv_1fI5rIgS1f&index=1) -## Directory Layout +### Directory Layout There are three important directories: @@ -41,9 +100,9 @@ There are two approaches: 1. [Local](#local-installation) installation, which means you have to take care of dependencies yourself. 2. **Or** Install everything through [Docker](#docker-installation) which takes care of dependencies for you. -## Installation +### Installation -### Clone the Repository +#### Clone the Repository Clone the repository, this will create a new folder called `Ocelot-Social`: @@ -65,7 +124,7 @@ Change into the new folder. $ cd Ocelot-Social ``` -## Live Demo And Developer Logins +### Live Demo And Developer Logins **Try out our deployed [development environment](https://stage.ocelot.social).** @@ -74,7 +133,7 @@ Visit our staging networks: * central staging network: [stage.ocelot.social](https://stage.ocelot.social) -### Login +#### Login Logins for the live demos and developers (local developers after the following installations) in the browser: @@ -84,11 +143,11 @@ Logins for the live demos and developers (local developers after the following i | `moderator@example.org` | 1234 | moderator | | `admin@example.org` | 1234 | admin | -### Docker Installation +#### Docker Installation Docker is a software development container tool that combines software and its dependencies into one standardized unit that contains everything needed to run it. This helps us to avoid problems with dependencies and makes installation easier. -#### General Installation of Docker +##### General Installation of Docker There are [several ways to install Docker CE](https://docs.docker.com/install/) on your computer or server. @@ -105,7 +164,7 @@ $ docker-compose --version docker-compose version 1.23.2 ``` -#### Start Ocelot-Social via Docker-Compose +##### Start Ocelot-Social via Docker-Compose Prepare ENVs once beforehand: @@ -152,11 +211,11 @@ $ docker-compose exec backend yarn run db:seed For a closer description see [backend README.md](./backend/README.md). For a full documentation see [SUMMARY](./SUMMARY.md). -### Local Installation +#### Local Installation For a full documentation see [SUMMARY](./SUMMARY.md). -## Contributing +### Contributing Choose an issue (consider our label [good-first-issue](https://github.com/Ocelot-Social-Community/Ocelot-Social/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)) and leave a comment there. We will then invite you to join our volunteers team. To have the necessary permission to push directly to this repository, please accept our invitation to join our volunteers team, you will receive via the email, Github will send you, once invited. If we did not invite you yet, please request an invitation via Discord. @@ -182,7 +241,7 @@ $ yarn test Check out our [contribution guideline](./CONTRIBUTING.md), too! -### Developer Chat +#### Developer Chat Join our friendly open-source community on [Discord](https://discord.gg/AJSX9DCSUA) :heart_eyes_cat: Just introduce yourself at `#introduce-yourself` and mention a mentor or `@@Mentors` to get you onboard :neckbeard: @@ -190,13 +249,13 @@ Just introduce yourself at `#introduce-yourself` and mention a mentor or `@@Ment We give write permissions to every developer who asks for it. Just text us on [Discord](https://discord.gg/AJSX9DCSUA). -## Deployment +### Deployment Deployment methods can be found in the [Ocelot-Social-Deploy-Rebranding](https://github.com/Ocelot-Social-Community/Ocelot-Social-Deploy-Rebranding) repository. The only deployment method in this repository for development purposes as described above is `docker-compose`. -## Technology Stack +### Technology Stack * [VueJS](https://vuejs.org/) * [NuxtJS](https://nuxtjs.org/) @@ -204,7 +263,7 @@ The only deployment method in this repository for development purposes as descri * [NodeJS](https://nodejs.org/en/) * [Neo4J](https://neo4j.com/) -### For Testing +#### For Testing * [Cypress](https://docs.cypress.io/) * [Storybook](https://storybook.js.org/) @@ -212,7 +271,7 @@ The only deployment method in this repository for development purposes as descri * [Vue Test Utils](https://vue-test-utils.vuejs.org/) * [ESLint](https://eslint.org/) -## Attributions +### Attributions Locale Icons made by [Freepik](http://www.freepik.com/) from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/). @@ -220,6 +279,6 @@ Browser compatibility testing with [BrowserStack](https://www.browserstack.com/) BrowserStack Logo -## License +### License See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT). From d41b99b9135625c0d94053b612f5292f77caf87c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 15:00:52 +0100 Subject: [PATCH 66/94] feat(backend): filter posts of my groups --- .../helpers/filterPostsOfMyGroups.js | 40 +++++++++++++++++++ backend/src/schema/resolvers/posts.js | 3 ++ backend/src/schema/types/type/Post.gql | 1 + 3 files changed, 44 insertions(+) create mode 100644 backend/src/schema/resolvers/helpers/filterPostsOfMyGroups.js diff --git a/backend/src/schema/resolvers/helpers/filterPostsOfMyGroups.js b/backend/src/schema/resolvers/helpers/filterPostsOfMyGroups.js new file mode 100644 index 000000000..a808a5582 --- /dev/null +++ b/backend/src/schema/resolvers/helpers/filterPostsOfMyGroups.js @@ -0,0 +1,40 @@ +import { mergeWith, isArray } from 'lodash' + +const getMyGroupIds = async (context) => { + const { user } = context + if (!(user && user.id)) return [] + const session = context.driver.session() + + const readTxResultPromise = await session.readTransaction(async (transaction) => { + const cypher = ` + MATCH (group:Group)<-[membership:MEMBER_OF]-(:User { id: $userId }) + WHERE membership.role IN ['usual', 'admin', 'owner'] + RETURN collect(group.id) AS myGroupIds` + const getMyGroupIdsResponse = await transaction.run(cypher, { userId: user.id }) + return getMyGroupIdsResponse.records.map((record) => record.get('myGroupIds')) + }) + try { + const [myGroupIds] = readTxResultPromise + return myGroupIds + } finally { + session.close() + } +} + +export const filterPostsOfMyGroups = async (params, context) => { + if (!(params.filter && params.filter.postsInMyGroups)) return params + delete params.filter.postsInMyGroups + const myGroupIds = await getMyGroupIds(context) + params.filter = mergeWith( + params.filter, + { + group: { id_in: myGroupIds }, + }, + (objValue, srcValue) => { + if (isArray(objValue)) { + return objValue.concat(srcValue) + } + }, + ) + return params +} diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index 78515e641..d806f3803 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -6,6 +6,7 @@ import { mergeImage, deleteImage } from './images/images' import Resolver from './helpers/Resolver' import { filterForMutedUsers } from './helpers/filterForMutedUsers' import { filterInvisiblePosts } from './helpers/filterInvisiblePosts' +import { filterPostsOfMyGroups } from './helpers/filterPostsOfMyGroups' import CONFIG from '../../config' const maintainPinnedPosts = (params) => { @@ -21,12 +22,14 @@ const maintainPinnedPosts = (params) => { export default { Query: { Post: async (object, params, context, resolveInfo) => { + params = await filterPostsOfMyGroups(params, context) params = await filterInvisiblePosts(params, context) params = await filterForMutedUsers(params, context) params = await maintainPinnedPosts(params) return neo4jgraphql(object, params, context, resolveInfo) }, profilePagePosts: async (object, params, context, resolveInfo) => { + params = await filterPostsOfMyGroups(params, context) params = await filterInvisiblePosts(params, context) params = await filterForMutedUsers(params, context) return neo4jgraphql(object, params, context, resolveInfo) diff --git a/backend/src/schema/types/type/Post.gql b/backend/src/schema/types/type/Post.gql index 9eac00b0b..6fc7a3215 100644 --- a/backend/src/schema/types/type/Post.gql +++ b/backend/src/schema/types/type/Post.gql @@ -82,6 +82,7 @@ input _PostFilter { emotions_single: _PostEMOTEDFilter emotions_every: _PostEMOTEDFilter group: _GroupFilter + postsInMyGroups: Boolean } enum _PostOrdering { From 11a7dc28816fbf803d28e39ad562b1a7b6497c5f Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 15:28:43 +0100 Subject: [PATCH 67/94] test filter posts in my groups --- .../schema/resolvers/postsInGroups.spec.js | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/backend/src/schema/resolvers/postsInGroups.spec.js b/backend/src/schema/resolvers/postsInGroups.spec.js index 5bf5820f0..02c7311a7 100644 --- a/backend/src/schema/resolvers/postsInGroups.spec.js +++ b/backend/src/schema/resolvers/postsInGroups.spec.js @@ -60,7 +60,7 @@ beforeAll(async () => { }) afterAll(async () => { - await cleanDatabase() + // await cleanDatabase() driver.close() }) @@ -1678,5 +1678,59 @@ describe('Posts in Groups', () => { }) }) }) + + describe('filter posts in my groups', () => { + describe('without any posts in groups', () => { + beforeAll(async () => { + authenticatedUser = await anyUser.toJson() + }) + + it('finds no posts', async () => { + const result = await query({ + query: filterPosts(), + variables: { filter: { postsInMyGroups: true } }, + }) + expect(result.data.Post).toHaveLength(0) + expect(result).toMatchObject({ + data: { + Post: [], + }, + errors: undefined, + }) + }) + }) + + describe('with posts in groups', () => { + beforeAll(async () => { + // member of hidden-group and closed-group + authenticatedUser = await allGroupsUser.toJson() + }) + + it('finds two posts', async () => { + const result = await query({ + query: filterPosts(), + variables: { filter: { postsInMyGroups: true } }, + }) + expect(result.data.Post).toHaveLength(2) + expect(result).toMatchObject({ + data: { + Post: expect.arrayContaining([ + { + id: 'post-to-closed-group', + title: 'A post to a closed group', + content: 'I am posting into a closed group as a member of the group', + }, + { + id: 'post-to-hidden-group', + title: 'A post to a hidden group', + content: 'I am posting into a hidden group as a member of the group', + }, + ]), + }, + errors: undefined, + }) + }) + }) + }) }) }) From 77ca09ed04170828fc66ad120070a17beb7d791b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 15:32:29 +0100 Subject: [PATCH 68/94] after all clean DB --- backend/src/schema/resolvers/postsInGroups.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/schema/resolvers/postsInGroups.spec.js b/backend/src/schema/resolvers/postsInGroups.spec.js index 02c7311a7..1eaf7a708 100644 --- a/backend/src/schema/resolvers/postsInGroups.spec.js +++ b/backend/src/schema/resolvers/postsInGroups.spec.js @@ -60,7 +60,7 @@ beforeAll(async () => { }) afterAll(async () => { - // await cleanDatabase() + await cleanDatabase() driver.close() }) From d2462c34f1eb2beffc15babae243ff52dc068028 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 16:00:50 +0100 Subject: [PATCH 69/94] add filter by posts in my groups to store and test it --- webapp/store/posts.js | 16 +++++++++++++++ webapp/store/posts.spec.js | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/webapp/store/posts.js b/webapp/store/posts.js index 5d9891eff..e8602bb13 100644 --- a/webapp/store/posts.js +++ b/webapp/store/posts.js @@ -30,6 +30,19 @@ export const mutations = { } } }, + TOGGLE_FILTER_BY_MY_GROUPS(state) { + const filter = clone(state.filter) + const status = get(filter, 'postsInMyGroups') + if (status) { + delete filter.postsInMyGroups + state.filter = filter + } else { + state.filter = { + ...filter, + postsInMyGroups: true, + } + } + }, RESET_CATEGORIES(state) { const filter = clone(state.filter) delete filter.categories_some @@ -84,6 +97,9 @@ export const getters = { filteredByUsersFollowed(state) { return !!get(state.filter, 'author.followedBy_some.id') }, + filteredByPostsInMyGroups(state) { + return !!get(state.filter, 'postsInMyGroups') + }, filteredByEmotions(state) { return get(state.filter, 'emotions_some.emotion_in') || [] }, diff --git a/webapp/store/posts.spec.js b/webapp/store/posts.spec.js index ed728bdd8..665b147ae 100644 --- a/webapp/store/posts.spec.js +++ b/webapp/store/posts.spec.js @@ -56,6 +56,18 @@ describe('getters', () => { }) }) + describe('filteredByPostsInMyGroups', () => { + it('returns true if filter is set', () => { + state = { filter: { postsInMyGroups: true } } + expect(getters.filteredByPostsInMyGroups(state)).toBe(true) + }) + + it('returns false if filter is not set', () => { + state = { filter: { categories_some: { id_in: [23] } } } + expect(getters.filteredByUsersFollowed(state)).toBe(false) + }) + }) + describe('filteredByEmotions', () => { it('returns an emotions array if filter is set', () => { state = { filter: { emotions_some: { emotion_in: ['sad'] } } } @@ -230,6 +242,35 @@ describe('mutations', () => { }) }) + describe('TOGGLE_FILTER_BY_MY_GROUPS', () => { + beforeEach(() => { + testMutation = () => { + mutations.TOGGLE_FILTER_BY_MY_GROUPS(state) + return getters.filter(state) + } + }) + + describe('given empty filter', () => { + beforeEach(() => { + state = { filter: {} } + }) + + it('sets postsInMyGroups filter to true', () => { + expect(testMutation()).toEqual({ postsInMyGroups: true }) + }) + }) + + describe('already filtered', () => { + beforeEach(() => { + state = { filter: { postsInMyGroups: true } } + }) + + it('removes postsInMyGroups filter', () => { + expect(testMutation()).toEqual({}) + }) + }) + }) + describe('TOGGLE_ORDER', () => { beforeEach(() => { testMutation = (key) => { From b63ade8da1e5392fe84117b9375b61f7c9c2c121 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 16:05:15 +0100 Subject: [PATCH 70/94] add filter posts by my groups --- webapp/components/FilterMenu/FilterMenuSection.vue | 5 +++-- webapp/components/FilterMenu/FollowingFilter.vue | 11 +++++++++++ webapp/locales/de.json | 2 ++ webapp/locales/en.json | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/webapp/components/FilterMenu/FilterMenuSection.vue b/webapp/components/FilterMenu/FilterMenuSection.vue index 921bafff0..39c819563 100644 --- a/webapp/components/FilterMenu/FilterMenuSection.vue +++ b/webapp/components/FilterMenu/FilterMenuSection.vue @@ -4,13 +4,14 @@
    +
+ + -->
    diff --git a/webapp/components/FilterMenu/FollowingFilter.vue b/webapp/components/FilterMenu/FollowingFilter.vue index 7c2c2a282..93f0c05b4 100644 --- a/webapp/components/FilterMenu/FollowingFilter.vue +++ b/webapp/components/FilterMenu/FollowingFilter.vue @@ -10,6 +10,15 @@ @click="toggleFilteredByFollowed(currentUser.id)" /> +
  • + +
  • @@ -28,12 +37,14 @@ export default { computed: { ...mapGetters({ filteredByUsersFollowed: 'posts/filteredByUsersFollowed', + filteredByPostsInMyGroups: 'posts/filteredByPostsInMyGroups', currentUser: 'auth/user', }), }, methods: { ...mapMutations({ toggleFilteredByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED', + toggleFilteredByMyGroups: 'posts/TOGGLE_FILTER_BY_MY_GROUPS', }), }, } diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 9ea733068..2c7d84354 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -273,6 +273,7 @@ "myTopics": "Meine Themen", "noFilter": "Beiträge filtern" }, + "filterMyGroups": "Beiträge in meinen Gruppen", "inappropriatePicture": "Dieses Bild kann für einige Menschen unangemessen sein.", "languageSelectLabel": "Sprache Deines Beitrags", "languageSelectText": "Sprache wählen", @@ -380,6 +381,7 @@ "filter-by": "Filtern nach ...", "following": "Nutzer denen ich folge", "languages": "Sprachen", + "my-groups": "Meinen Gruppen", "order": { "newest": { "hint": "Sortiere die Neuesten nach vorn", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 9e45396b8..87e7318c7 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -273,6 +273,7 @@ "myTopics": "My topics", "noFilter": "Filter posts" }, + "filterMyGroups": "Contributions in my groups", "inappropriatePicture": "This image may be inappropriate for some people.", "languageSelectLabel": "Language of your contribution", "languageSelectText": "Select Language", @@ -380,6 +381,7 @@ "filter-by": "Filter by ...", "following": "Users I follow", "languages": "Languages", + "my-groups": "My groups", "order": { "newest": { "hint": "Sort posts by the newest first", From a784b0f86000e9ccae1832f0fbbe992ef8c4a9b5 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 16:11:17 +0100 Subject: [PATCH 71/94] test filter by posts in my groups --- .../FilterMenu/FollowingFilter.spec.js | 17 +++++++++++++++++ .../components/FilterMenu/FollowingFilter.vue | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/webapp/components/FilterMenu/FollowingFilter.spec.js b/webapp/components/FilterMenu/FollowingFilter.spec.js index 4d4a827e5..0f51b305c 100644 --- a/webapp/components/FilterMenu/FollowingFilter.spec.js +++ b/webapp/components/FilterMenu/FollowingFilter.spec.js @@ -9,12 +9,14 @@ let wrapper describe('FollowingFilter', () => { const mutations = { 'posts/TOGGLE_FILTER_BY_FOLLOWED': jest.fn(), + 'posts/TOGGLE_FILTER_BY_MY_GROUPS': jest.fn(), } const getters = { 'auth/user': () => { return { id: 'u34' } }, 'posts/filteredByUsersFollowed': jest.fn(), + 'posts/filteredByPostsInMyGroups': jest.fn(), } const mocks = { @@ -34,12 +36,18 @@ describe('FollowingFilter', () => { describe('mount', () => { it('sets "filter-by-followed" button attribute `filled`', () => { getters['posts/filteredByUsersFollowed'] = jest.fn(() => true) + getters['posts/filteredByPostsInMyGroups'] = jest.fn(() => true) const wrapper = Wrapper() expect( wrapper .find('.following-filter .filter-list .follower-item .base-button') .classes('--filled'), ).toBe(true) + expect( + wrapper + .find('.following-filter .filter-list .posts-in-my-groups-item .base-button') + .classes('--filled'), + ).toBe(true) }) describe('click "filter-by-followed" button', () => { @@ -48,5 +56,14 @@ describe('FollowingFilter', () => { expect(mutations['posts/TOGGLE_FILTER_BY_FOLLOWED']).toHaveBeenCalledWith({}, 'u34') }) }) + + describe('click "filter-by-my-groups" button', () => { + it('calls TOGGLE_FILTER_BY_MY_GROUPS', () => { + wrapper + .find('.following-filter .filter-list .posts-in-my-groups-item .base-button') + .trigger('click') + expect(mutations['posts/TOGGLE_FILTER_BY_MY_GROUPS']).toHaveBeenCalled() + }) + }) }) }) diff --git a/webapp/components/FilterMenu/FollowingFilter.vue b/webapp/components/FilterMenu/FollowingFilter.vue index 93f0c05b4..9a488acd6 100644 --- a/webapp/components/FilterMenu/FollowingFilter.vue +++ b/webapp/components/FilterMenu/FollowingFilter.vue @@ -16,7 +16,7 @@ :label="$t('filter-menu.my-groups')" :filled="filteredByPostsInMyGroups" :title="$t('contribution.filterMyGroups')" - @click="toggleFilteredByMyGroups(currentUser.id)" + @click="toggleFilteredByMyGroups()" /> From 1575ee97652bb4b31d16f2cae508221a43394c60 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 16:20:45 +0100 Subject: [PATCH 72/94] =?UTF-8?q?Ebertsche=20Kn=C3=B6pfe=20for=20filter=20?= =?UTF-8?q?by=20posts=20in=20my=20groups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/locales/de.json | 1 + webapp/locales/en.json | 1 + webapp/pages/index.vue | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 2c7d84354..1db5a3dcd 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -270,6 +270,7 @@ "filterFollow": "Beiträge von Nutzern filtern, denen ich folge", "filterMasonryGrid": { "myFriends": "Nutzer denen ich folge", + "myGroups": "Meine Gruppen", "myTopics": "Meine Themen", "noFilter": "Beiträge filtern" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 87e7318c7..f7a7a54ad 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -270,6 +270,7 @@ "filterFollow": "Filter contributions from users I follow", "filterMasonryGrid": { "myFriends": "Users I follow", + "myGroups": "My groups", "myTopics": "My topics", "noFilter": "Filter posts" }, diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index d5f1ac3d0..ddadec9a8 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -30,7 +30,11 @@
    + + + {{ $t('contribution.filterMasonryGrid.myGroups') }} + + + +
    @@ -203,6 +221,7 @@ export default { methods: { ...mapMutations({ resetByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED', + resetByGroups: 'posts/TOGGLE_FILTER_BY_MY_GROUPS', resetCategories: 'posts/RESET_CATEGORIES', toggleCategory: 'posts/TOGGLE_CATEGORY', }), From 1fa883111057dc46ffb38adc7c2e386d364d6ba4 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 16:25:45 +0100 Subject: [PATCH 73/94] undo changes to filter menu section --- webapp/components/FilterMenu/FilterMenuSection.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/webapp/components/FilterMenu/FilterMenuSection.vue b/webapp/components/FilterMenu/FilterMenuSection.vue index 39c819563..921bafff0 100644 --- a/webapp/components/FilterMenu/FilterMenuSection.vue +++ b/webapp/components/FilterMenu/FilterMenuSection.vue @@ -4,14 +4,13 @@
      -
    + + -->
      From 32aa5892a67e4dedc74b4f6c733cb231941128af Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Mar 2023 16:29:35 +0100 Subject: [PATCH 74/94] improve code --- webapp/store/posts.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/store/posts.js b/webapp/store/posts.js index e8602bb13..587867b0e 100644 --- a/webapp/store/posts.js +++ b/webapp/store/posts.js @@ -32,8 +32,7 @@ export const mutations = { }, TOGGLE_FILTER_BY_MY_GROUPS(state) { const filter = clone(state.filter) - const status = get(filter, 'postsInMyGroups') - if (status) { + if (get(filter, 'postsInMyGroups')) { delete filter.postsInMyGroups state.filter = filter } else { From 1b27c17779039e9167ae6d354ff30237c1b6ef17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 6 Mar 2023 18:30:56 +0100 Subject: [PATCH 75/94] Remove `deployment/DOCKER_MORE_CLOSELY.md` --- deployment/DOCKER_MORE_CLOSELY.md | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 deployment/DOCKER_MORE_CLOSELY.md diff --git a/deployment/DOCKER_MORE_CLOSELY.md b/deployment/DOCKER_MORE_CLOSELY.md deleted file mode 100644 index 2bf213a33..000000000 --- a/deployment/DOCKER_MORE_CLOSELY.md +++ /dev/null @@ -1,9 +0,0 @@ -# Docker - -## Apple M1 Platform - -To get more information about the Apple M1 platform you find our documentation in our main code, [here](/CONTRIBUTING.md#docker-more-closely). - -## Docker More Closely In Main Code - -To get more information about how to analyze the Docker builds etc. you find our documentation in our main code, [here](/CONTRIBUTING.md#docker-more-closely). From cd498a17f0cfa3af6183c055a53b3c1f4b1f1ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 6 Mar 2023 18:31:56 +0100 Subject: [PATCH 76/94] Replace docu text by Ulf's suggestion Co-Authored-By: Ulf Gebhardt --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b2c8a7dbb..a677f39bb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -175,7 +175,7 @@ Please copy and paste the following quotes for the languages: #### Environment Variable For Apple M1 Platform To set the following environment variable seems not be needed anymore, probably because Docker knows in its newest version on which CPU it runs and sets that to default. -But we leave this command here to keep the knowledge about how to set the platform: +If you encounter trouble building the docker containers on an Apple M1 chip you can try to explicitly define the target platform docker builds and pulls images for: ```bash # set env variable for your shell From fa7927a379ed8705ffecd313fb27c45f635bf60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 6 Mar 2023 18:34:27 +0100 Subject: [PATCH 77/94] Replace docu text by Ulf's suggestion Co-Authored-By: Ulf Gebhardt --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a677f39bb..650785331 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -174,7 +174,6 @@ Please copy and paste the following quotes for the languages: #### Environment Variable For Apple M1 Platform -To set the following environment variable seems not be needed anymore, probably because Docker knows in its newest version on which CPU it runs and sets that to default. If you encounter trouble building the docker containers on an Apple M1 chip you can try to explicitly define the target platform docker builds and pulls images for: ```bash From 9bb770ae8e1510f0cdd788ca81f1baaf68568b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 6 Mar 2023 18:50:26 +0100 Subject: [PATCH 78/94] Fix spelling of README.md Co-authored-by: Moriz Wahl --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d483dc79..35af4ce80 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Try out our live demo network, see [here](#live-demo-and-developer-logins). ## Help us -If you're wondering how could you help, there are plenty of ways, e.g.: +If you're wondering how you could help, there are plenty of ways, e.g.: * Spread the good word about ocelot.social to make it more popular: * Add the link [ocelot.social](https://ocelot.social) to your website. From ec77da7ad3cc8cbedec1fdc080e8622cdc89c1f0 Mon Sep 17 00:00:00 2001 From: sushidave Date: Mon, 6 Mar 2023 19:06:28 +0100 Subject: [PATCH 79/94] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35af4ce80..1fa2ffa2f 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Ocelot.social networks feature: * maps * search * filters -* ...and more. +* and more … Check out the [full feature list](/wiki/en:FAQ#what-are-the-features). From aba74cd5c68c66b342ccdbc2d69cd017b92606ae Mon Sep 17 00:00:00 2001 From: sushidave Date: Mon, 6 Mar 2023 19:08:29 +0100 Subject: [PATCH 80/94] Change order of sections --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1fa2ffa2f..8ddf97fe5 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ At the same time, it should be possible in the future to link these networks wit In other words, we are interested in a network of networks and in keeping the data as close as possible to the user and the operator they trusts. +## Screenshots + +Post feed + +Check out more screenshots [here](/wiki/en:Screenshots). + ## Features Ocelot.social networks feature: @@ -34,12 +40,6 @@ Ocelot.social networks feature: Check out the [full feature list](/wiki/en:FAQ#what-are-the-features). -## Screenshots - -Post feed - -Check out more screenshots [here](/wiki/en:Screenshots). - ## User Guide and Frequently Asked Questions In the [wiki](/wiki) you can find more information. From ace8b8637ffb81172ad048f0e3e2cdaa8f19fcf5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 7 Mar 2023 16:08:32 +0100 Subject: [PATCH 81/94] dont rebase automatically to avoid workflow slots beeing used --- .github/dependabot.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 085fedb18..ac1dfa858 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,16 +2,16 @@ version: 2 updates: - package-ecosystem: "github-actions" directory: "/" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" timezone: "Europe/Berlin" time: "03:00" - # open-pull-requests-limit: 10 - # ignore: - package-ecosystem: npm directory: "/" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" @@ -19,6 +19,7 @@ updates: time: "03:00" - package-ecosystem: npm directory: "/backend" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" @@ -26,6 +27,7 @@ updates: time: "03:00" - package-ecosystem: npm directory: "/webapp" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" @@ -34,6 +36,7 @@ updates: - package-ecosystem: docker directory: "/backend" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" @@ -41,6 +44,7 @@ updates: time: "03:00" - package-ecosystem: docker directory: "/webapp" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" @@ -48,6 +52,7 @@ updates: time: "03:00" - package-ecosystem: docker directory: "/neo4j" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" @@ -55,6 +60,7 @@ updates: time: "03:00" - package-ecosystem: docker directory: "/deployment/src/docker" + rebase-strategy: "disabled" schedule: interval: weekly day: "saturday" From 7fcb9a0ff6c9aec01858d90420aeea48e7faed93 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 7 Mar 2023 22:33:14 +0100 Subject: [PATCH 82/94] use base button --- webapp/components/Group/GroupMember.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/components/Group/GroupMember.vue b/webapp/components/Group/GroupMember.vue index c0cdc67ea..d6c09746e 100644 --- a/webapp/components/Group/GroupMember.vue +++ b/webapp/components/Group/GroupMember.vue @@ -53,7 +53,7 @@ Date: Wed, 8 Mar 2023 09:21:44 +0100 Subject: [PATCH 83/94] fix deploy branded --- .github/workflows/publish-branded.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/publish-branded.yml b/.github/workflows/publish-branded.yml index a404453e6..869eb6302 100644 --- a/.github/workflows/publish-branded.yml +++ b/.github/workflows/publish-branded.yml @@ -46,6 +46,11 @@ jobs: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ github.event.client_payload.ref }} + - name: Download Docker Image (Backend) uses: actions/download-artifact@v2 with: From b28a595ae409c99b181cd228523558a222b096d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 8 Mar 2023 16:22:53 +0100 Subject: [PATCH 84/94] Change group filter button text --- webapp/locales/de.json | 2 +- webapp/locales/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 1db5a3dcd..5b95cd632 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -270,7 +270,7 @@ "filterFollow": "Beiträge von Nutzern filtern, denen ich folge", "filterMasonryGrid": { "myFriends": "Nutzer denen ich folge", - "myGroups": "Meine Gruppen", + "myGroups": "Aus meinen Gruppen", "myTopics": "Meine Themen", "noFilter": "Beiträge filtern" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index f7a7a54ad..b13757893 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -270,7 +270,7 @@ "filterFollow": "Filter contributions from users I follow", "filterMasonryGrid": { "myFriends": "Users I follow", - "myGroups": "My groups", + "myGroups": "By my groups", "myTopics": "My topics", "noFilter": "Filter posts" }, From b64e35c69bae7bc1ffa26705f3147911e6701e4d Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 8 Mar 2023 17:11:57 +0100 Subject: [PATCH 85/94] fix typo --- webapp/components/FilterMenu/FilterMenu.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/FilterMenu/FilterMenu.vue b/webapp/components/FilterMenu/FilterMenu.vue index a1aed3950..fcd386c38 100644 --- a/webapp/components/FilterMenu/FilterMenu.vue +++ b/webapp/components/FilterMenu/FilterMenu.vue @@ -10,7 +10,7 @@ > -