Skip to content

Commit

Permalink
Merge branch 'master' into feat/supabase-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
mariojsnunes committed Jan 17, 2025
2 parents 41a53b3 + 224814a commit c5c2815
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 17 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,15 @@
"contributions": [
"doc"
]
},
{
"login": "ebradbury",
"name": "Elliot Bradbury",
"avatar_url": "https://avatars.githubusercontent.com/u/253679?v=4",
"profile": "https://github.com/ebradbury",
"contributions": [
"code"
]
}
],
"projectName": "community-platform",
Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ jobs:
- checkout
- attach_workspace:
at: '.'
- run: npx supabase login --token $SUPABASE_ACCESS_TOKEN
- run: (yes || true) | npx supabase db push --db-url $SUPABASE_DB_URL
- run: npx supabase@2.6.8 login --token $SUPABASE_ACCESS_TOKEN
- run: (yes || true) | npx supabase@2.6.8 db push --db-url $SUPABASE_DB_URL --debug
# Run cypress e2e tests on chrome
test_e2e:
docker: *docker
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ What kind of change does this PR introduce?
_Describe the new behaviour_
_If useful, provide screenshot or capture to highlight main changes_

## Does this PR introduce a breaking change?
## Does this PR introduce a DB Schema Change or Migration?

- [ ] Yes
- [ ] No
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/pr-preview-fly-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@ jobs:
# pull the repo from the pull request source, not the default local repo
ref: ${{ github.event.pull_request.head.sha }}

- name: Install supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest
# Commented out so there are no schema conflicts between preview branches.
# A better solution would be to use Supabase Branching: https://supabase.com/docs/guides/deployment/branching
# - name: Install supabase CLI
# uses: supabase/setup-cli@v1
# with:
# version: 2.6.8

- name: Link Supabase project
run: supabase link --project-ref $SUPABASE_PROJECT_ID
# - name: Link Supabase project
# run: supabase link --project-ref $SUPABASE_PROJECT_ID

- name: Push Supabase DB
run: supabase db push
# - name: Push Supabase DB
# run: supabase db push

- name: Install Fly CLI
run: |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Thanks go to these wonderful people ([emoji key](https://allcontributors.org/doc
<td align="center" valign="top" width="14.28%"><a href="http://johannesross.de"><img src="https://avatars.githubusercontent.com/u/74828657?v=4?s=60" width="60px;" alt="Johannes Roß"/><br /><sub><b>Johannes Roß</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=johannes-ross" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/detrina"><img src="https://avatars.githubusercontent.com/u/155117116?v=4?s=60" width="60px;" alt="Devkuni"/><br /><sub><b>Devkuni</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=detrina" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Bilogweb3"><img src="https://avatars.githubusercontent.com/u/155262265?v=4?s=60" width="60px;" alt="Bilog WEB3"/><br /><sub><b>Bilog WEB3</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=Bilogweb3" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ebradbury"><img src="https://avatars.githubusercontent.com/u/253679?v=4?s=60" width="60px;" alt="Elliot Bradbury"/><br /><sub><b>Elliot Bradbury</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=ebradbury" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
58 changes: 58 additions & 0 deletions packages/cypress/src/integration/research/write.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ describe('[Research]', () => {
.type(updateVideoUrl)
.blur({ force: true })

cy.step('Add file to update')

// click the "Upload Files" button to show the uppy dashboard modal
cy.get('[data-cy=file-input-field]').click()

// set the file input value to our test fixture file, and click upload button
cy.get('.uppy-Dashboard-input:first').as('file-input')
cy.get('@file-input').selectFile('src/fixtures/files/Example.pdf', {
force: true,
})
cy.get('.uppy-StatusBar-actionBtn--upload').as('upload-button')
cy.get('@upload-button').click()

cy.step('Published when fields are populated correctly')
cy.get('[data-cy=errors-container]').should('not.exist')
cy.get('[data-cy=submit]').click()
Expand All @@ -142,6 +155,51 @@ describe('[Research]', () => {

cy.contains(updateTitle).should('be.visible')
cy.contains(updateDescription).should('be.visible')
cy.get('[data-cy=file-download-counter]').should(
'have.text',
'0 downloads',
)

// download the file then check the counter
cy.step('Download counter increments')
cy.get('[data-cy=downloadButton]').click()
cy.get('[data-cy=DonationRequestSkip]')
.invoke('removeAttr', 'target')
.click()
cy.go('back')
cy.reload()
cy.get('[data-cy=file-download-counter]').should(
'have.text',
'1 download',
)

cy.step('Download count is preserved when replacing file')
cy.get('[data-cy=edit-update]').click()
cy.get('[data-cy=delete-file]').click()

// click the "Upload Files" button to show the uppy dashboard modal
cy.get('[data-cy=file-input-field]').click()

// set the file input value to our test fixture file, and click upload button
cy.get('.uppy-Dashboard-input:first').as('file-input')
cy.get('@file-input').selectFile('src/fixtures/files/Example.pdf', {
force: true,
})
cy.get('.uppy-StatusBar-actionBtn--upload').as('upload-button')
cy.get('@upload-button').click()

cy.get('[data-cy=errors-container]').should('not.exist')
cy.get('[data-cy=submit]').click()

cy.step('Open the research update')
cy.get('[data-cy=view-research]:enabled', { timeout: 20000 })
.click()
.url()

cy.get('[data-cy=file-download-counter]').should(
'have.text',
'1 download',
)
})

it('[By Anonymous]', () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/cypress/src/support/commandsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Cypress.Commands.add('setSettingImage', (image, selector) => {
.attachFile(`images/${image}.jpg`)
})

Cypress.Commands.add('setFile', (filePath, selector) => {
cy.get(`[data-cy=${selector}]`).find(':file').attachFile(filePath)
})

Cypress.Commands.add('setSettingImpactData', (year: number, fields) => {
cy.step('Save impact data')
cy.get('[data-cy="tab-Impact"]').click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const AlreadyAddedFiles = ({ formValues, setFileEditMode }) => {
type="button"
variant="outline"
icon="delete"
data-cy="delete-file"
onClick={deleteFile}
>
{buttons.files}
Expand Down Expand Up @@ -86,6 +87,7 @@ const UploadNewFiles = () => {
<Field
hasText={false}
name={'files'}
data-cy="file-input-field"
component={FileInputField}
/>
<Text color={'grey'} mt={4} sx={{ fontSize: 1 }}>
Expand All @@ -98,6 +100,7 @@ const UploadNewFiles = () => {
<Field
hasText={false}
name={'files'}
data-cy="file-input-field"
admin={true}
component={FileInputField}
/>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/common/Header/Menu/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ const Profile = observer((props: IProps) => {
}}
/>
) : (
<MemberBadge profileType={user.profileType} />
<MemberBadge
profileType={user.profileType}
sx={{ cursor: 'pointer' }}
/>
)}
</Flex>
<Flex>
Expand Down
9 changes: 5 additions & 4 deletions src/stores/Research/research.store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ export class ResearchStore extends ModuleStore {
logger.debug('upload images ok')
this.updateUpdateUploadStatus('Images')

if ((update.files && update.files.length) || update.fileLink) {
updateWithMeta.downloadCount = 0
}

if (update.files && update.files.length) {
const fileMeta = await this.uploadCollectionBatch(
update.files as File[],
Expand All @@ -256,6 +252,11 @@ export class ResearchStore extends ModuleStore {
logger.debug('upload files ok')
this.updateUpdateUploadStatus('Files')

// give downloadCount an initial value of 0 whether we're adding a file or not
if (updateWithMeta.downloadCount == undefined) {
updateWithMeta.downloadCount = 0
}

// populate DB
const existingUpdateIndex = item.updates.findIndex(
(upd) => upd._id === (update as IResearch.UpdateDB)._id,
Expand Down
2 changes: 1 addition & 1 deletion supabase/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ verify_enabled = true
# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`,
# `twitter`, `slack`, `spotify`, `workos`, `zoom`.
# [auth.external.apple]
[auth.external.apple]
enabled = false
client_id = ""
# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:
Expand Down

0 comments on commit c5c2815

Please sign in to comment.