Skip to content

Commit

Permalink
Merge pull request #4329 from coralproject/develop
Browse files Browse the repository at this point in the history
v8.5.0
  • Loading branch information
tessalt authored Aug 28, 2023
2 parents fd31f23 + a50fff7 commit 7536231
Show file tree
Hide file tree
Showing 109 changed files with 3,166 additions and 599 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
merge_group:

env:
IMAGE_REPOSITORY: 'gcr.io/the-coral-project/coral'
IMAGE_REPOSITORY: 'us-east1-docker.pkg.dev/the-coral-project/coral/talk'
IMAGE_CACHE_REPOSITORY: 'coralproject/ci'
DOCKERHUB_USERNAME: 'coralproject'

Expand All @@ -27,12 +27,12 @@ jobs:
with:
ssh-private-key: ${{ secrets.REPO_PATCHED_DEPLOY_KEY }}
-
name: Login to GCR
name: Login to GAR
uses: docker/login-action@v2
with:
registry: gcr.io
registry: us-east1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
password: ${{ secrets.GAR_JSON_KEY }}
-
name: Login to Docker Hub
uses: docker/login-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCR_JSON_KEY }}'
credentials_json: '${{ secrets.GAR_JSON_KEY }}'
-
name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'
Expand Down
10 changes: 6 additions & 4 deletions docs/docs/sso.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ You will then have to generate a JWT with the following claims:
about status changes on a user account such as bans or suspensions.
- `user.username` **(required)** - the username that should be used when being
presented inside Coral to moderators and other users. There are no username validations or restrictions enforced by Coral when you're using SSO.
- `user.badges` _(optional)_ - array of strings to be displayed as badges beside
username inside Coral, visible to other users and moderators. For example, to indicate
a user's subscription status. If you include the claim, but you are not passing a badge value, then use an empty array instead of null.
- `user.badges` _(optional)_ - array of strings to be displayed as badges and custom flair badges beside username inside Coral,
visible to other users and moderators. Badges are configured by passing through strings and can be used to indicate a user's subscription status.
- Custom flair badges are configured by passing through names that link to the desired flair badge image.
- To use custom flair badges, they must also be enabled in the admin, and each custom flair badge name, image URL must be added in the admin as well. If you include the badges claim, but you are not passing a badge value, then use an empty array instead of null.
- `user.role` _(optional)_ - one of "COMMENTER", "STAFF", "MODERATOR", "ADMIN". Will create/update
Coral user with this permission level. When users have both an assigned role greather than COMMENTER and a badge, both will be displayed.
- `user.url` _(optional)_ - url for user account management, where a user will
Expand All @@ -55,7 +56,8 @@ An example of the claims for this token would be:
"user": {
"id": "628bdc61-6616-4add-bfec-dd79156715d4",
"email": "bob@example.com",
"username": "bob"
"username": "bob",
"badges": ["subscriber", "https://www.example/com/image.jpg"]
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "8.4.2",
"version": "8.5.0",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down
159 changes: 90 additions & 69 deletions src/core/client/admin/components/BanModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Localized } from "@fluent/react/compat";
import { FORM_ERROR } from "final-form";
import React, {
FunctionComponent,
useCallback,
Expand Down Expand Up @@ -221,27 +222,40 @@ const BanModal: FunctionComponent<Props> = ({
const onFormSubmit = useCallback(async () => {
switch (updateType) {
case UpdateType.ALL_SITES:
await banUser({
userID, // Should be defined because the modal shouldn't open if author is null
message: customizeMessage ? emailMessage : getDefaultMessage,
rejectExistingComments,
siteIDs: viewerIsScoped
? viewer?.moderationScopes?.sites?.map(({ id }) => id)
: [],
});
try {
await banUser({
userID, // Should be defined because the modal shouldn't open if author is null
message: customizeMessage ? emailMessage : getDefaultMessage,
rejectExistingComments,
siteIDs: viewerIsScoped
? viewer?.moderationScopes?.sites?.map(({ id }) => id)
: [],
});
} catch (err) {
return { [FORM_ERROR]: err.message };
}
break;
case UpdateType.SPECIFIC_SITES:
await updateUserBan({
userID,
message: customizeMessage ? emailMessage : getDefaultMessage,
banSiteIDs,
unbanSiteIDs,
});
try {
await updateUserBan({
userID,
message: customizeMessage ? emailMessage : getDefaultMessage,
banSiteIDs,
unbanSiteIDs,
rejectExistingComments,
});
} catch (err) {
return { [FORM_ERROR]: err.message };
}
break;
case UpdateType.NO_SITES:
await removeUserBan({
userID,
});
try {
await removeUserBan({
userID,
});
} catch (err) {
return { [FORM_ERROR]: err.message };
}
}
if (banDomain) {
void createDomainBan({
Expand Down Expand Up @@ -326,59 +340,66 @@ const BanModal: FunctionComponent<Props> = ({
>
{/* BAN FROM/REJECT COMMENTS */}
<Flex direction="column">
{/* ban from header */}
<Localized id="community-banModal-banFrom">
<Label className={styles.banFromHeader}>Ban from</Label>
</Localized>
<Flex
direction="row"
className={styles.sitesOptions}
justifyContent="flex-start"
spacing={5}
>
{/* sites options */}
{showAllSitesOption && (
<FormField>
<Localized id="community-banModal-allSites">
<RadioButton
checked={updateType === UpdateType.ALL_SITES}
onChange={() =>
setUpdateType(UpdateType.ALL_SITES)
}
disabled={userBanStatus?.active}
>
All sites
</RadioButton>
</Localized>
</FormField>
)}
<FormField>
<Localized id="community-banModal-specificSites">
<RadioButton
checked={updateType === UpdateType.SPECIFIC_SITES}
onChange={() =>
setUpdateType(UpdateType.SPECIFIC_SITES)
}
>
Specific Sites
</RadioButton>
{isMultisite && (
<>
<Localized id="community-banModal-banFrom">
<Label className={styles.banFromHeader}>
Ban from
</Label>
</Localized>
</FormField>
{!viewerIsScoped && userHasAnyBan && (
<FormField>
<Localized id="community-banModal-noSites">
<RadioButton
checked={updateType === UpdateType.NO_SITES}
onChange={() =>
setUpdateType(UpdateType.NO_SITES)
}
>
No Sites
</RadioButton>
</Localized>
</FormField>
)}
</Flex>
<Flex
direction="row"
className={styles.sitesOptions}
justifyContent="flex-start"
spacing={5}
>
{/* sites options */}
{showAllSitesOption && (
<FormField>
<Localized id="community-banModal-allSites">
<RadioButton
checked={updateType === UpdateType.ALL_SITES}
onChange={() =>
setUpdateType(UpdateType.ALL_SITES)
}
disabled={userBanStatus?.active}
>
All sites
</RadioButton>
</Localized>
</FormField>
)}
<FormField>
<Localized id="community-banModal-specificSites">
<RadioButton
checked={
updateType === UpdateType.SPECIFIC_SITES
}
onChange={() =>
setUpdateType(UpdateType.SPECIFIC_SITES)
}
>
Specific Sites
</RadioButton>
</Localized>
</FormField>
{!viewerIsScoped && userHasAnyBan && (
<FormField>
<Localized id="community-banModal-noSites">
<RadioButton
checked={updateType === UpdateType.NO_SITES}
onChange={() =>
setUpdateType(UpdateType.NO_SITES)
}
>
No Sites
</RadioButton>
</Localized>
</FormField>
)}
</Flex>
</>
)}
{/* reject comments option */}
{updateType !== UpdateType.NO_SITES && (
<Localized
Expand Down
Loading

0 comments on commit 7536231

Please sign in to comment.