Skip to content

Commit

Permalink
Prevent users from reviewing their own edits
Browse files Browse the repository at this point in the history
Update NPM dependencies

Fix bug with undoing reviews

Disable Docker tests since that all needs to be rewritten anyway

Bug: T334272
  • Loading branch information
MusikAnimal committed Feb 13, 2024
1 parent 4428173 commit e3368c1
Show file tree
Hide file tree
Showing 14 changed files with 324 additions and 374 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
jsUnauthorized: true,
jsDbError: true,
jsUndoOwnOnly: true,
jsSelfReviewError: true,
jsUnknownError: true,
jsLoadMore: true,
jsNoMore: true,
Expand Down
139 changes: 70 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,73 +29,74 @@ jobs:
./bin/console lint:yaml ./config
./vendor/bin/minus-x check .
./bin/phpunit --exclude-group=integration
build_image:
name: Build Docker image
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
targets:
- name: production
tag: wikimedia/copypatrol
- name: development
tag: wikimedia/copypatrol-development
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build image
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
target: ${{ matrix.targets.name }}
tags: ${{ matrix.targets.tag }}:latest
outputs: type=docker,dest=/tmp/copypatrol-${{ matrix.targets.name }}.image.tar
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

- name: Upload Docker image to artifacts
uses: actions/upload-artifact@v2
with:
name: image-${{ matrix.targets.name }}
path: /tmp/copypatrol-${{ matrix.targets.name }}.image.tar
analysis:
name: Analyze Docker images
runs-on: ubuntu-latest
needs: build_image
strategy:
matrix:
targets:
- name: production
tag: wikimedia/copypatrol
- name: development
tag: wikimedia/copypatrol-development

steps:
- name: Download Docker image from artifacts
uses: actions/download-artifact@v2
with:
name: image-${{ matrix.targets.name }}
path: /tmp
- name: Load image
run: |
docker load --input /tmp/copypatrol-${{ matrix.targets.name }}.image.tar
docker image ls -a
- name: Dive
uses: yuichielectric/[email protected]
with:
image: ${{ matrix.targets.tag }}:latest
github-token: ${{ secrets.GITHUB_TOKEN }}
# build_image:
# name: Build Docker image
# runs-on: ubuntu-latest
# needs: build
# strategy:
# matrix:
# targets:
# - name: production
# tag: wikimedia/copypatrol
# - name: development
# tag: wikimedia/copypatrol-development
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
#
# - name: Set up Docker Buildx
# id: buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Build image
# id: docker_build
# uses: docker/build-push-action@v4
# with:
# context: .
# file: docker/Dockerfile
# target: ${{ matrix.targets.name }}
# tags: ${{ matrix.targets.tag }}:latest
# outputs: type=docker,dest=/tmp/copypatrol-${{ matrix.targets.name }}.image.tar
# cache-from: type=gha
# cache-to: type=gha,mode=max
#
# - name: Image digest
# run: echo ${{ steps.docker_build.outputs.digest }}
#
# - name: Upload Docker image to artifacts
# uses: actions/upload-artifact@v2
# with:
# name: image-${{ matrix.targets.name }}
# path: /tmp/copypatrol-${{ matrix.targets.name }}.image.tar
# analysis:
# name: Analyze Docker images
# runs-on: ubuntu-latest
# needs: build_image
# strategy:
# matrix:
# targets:
# - name: production
# tag: wikimedia/copypatrol
# - name: development
# tag: wikimedia/copypatrol-development
#
# steps:
# - name: Download Docker image from artifacts
# uses: actions/download-artifact@v2
# with:
# name: image-${{ matrix.targets.name }}
# path: /tmp
#
# - name: Load image
# run: |
# docker load --input /tmp/copypatrol-${{ matrix.targets.name }}.image.tar
# docker image ls -a
# - name: Dive
# uses: yuichielectric/[email protected]
# with:
# image: ${{ matrix.targets.tag }}:latest
# github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class CopyPatrol {
window.alert( jsDbError );
} else if ( error === 'wrong_user' ) {
window.alert( jsUndoOwnOnly );
} else if ( error === 'self_review' ) {
window.alert( jsSelfReviewError );
} else {
window.alert( 'Something went wrong. Please try again.' );
}
Expand Down
6 changes: 4 additions & 2 deletions assets/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,13 @@ a[ href='' ] {
content: '+';
}
}

.diff-neg {
color: #8B0000;
color: #8b0000;
}

.diff-zero {
color: #A2A9B1;
color: #a2a9b1;
}

.edit-tag {
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"js-dberror": "There was an error in connecting to database.",
"js-undo-own-only": "You can only undo your own reviews.",
"js-unknown-error": "An unknown error occurred when loading results. Please try again.",
"js-self-review": "You cannot review your own edits.",
"permalink": "Permalink",
"show-all-records": "Show all records",
"access-blocked": "You are currently $1 on $2 and are unable to use CopyPatrol.",
Expand Down
1 change: 1 addition & 0 deletions i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"js-dberror": "Alert shown to user when a database connection could not be made",
"js-undo-own-only": "Alert shown to user when they try to undo other people's reviews",
"js-unknown-error": "Alert shown to user when results could not be loaded, possibly due to connection issues, asking them to try again",
"js-self-review": "Alert shown to user when they attempt to review their own edits.",
"permalink": "Text for a permanent link to a particular record.\n{{Identical|Permalink}}",
"show-all-records": "Label for the button to show all records. This button is shown when the user went to a permalink that shows a single record.",
"access-blocked": "Message shown when a user is blocked on the wiki they are trying to view in CopyPatrol. \n\nParameters:\n* $1 — link to the block entry on the wiki, with the message 'blocked' as the link text. \n* $2 — domain of the wiki.",
Expand Down
Loading

0 comments on commit e3368c1

Please sign in to comment.