Skip to content

Commit

Permalink
Merge branch 'staging' of https://github.com/benawad/dogehouse into s…
Browse files Browse the repository at this point in the history
…taging
  • Loading branch information
amitojsingh366 committed May 6, 2021
2 parents 4768dc5 + a86ed06 commit a91c531
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 40 deletions.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This project is using the [conventional commits](https://www.conventionalcommits
commit messages are standardized:
1. Make sure your shell path is in the root of the project (not inside any of the packages).
2. Run `yarn`.
3. Stage the files you are commiting with `git add [files]`.
3. Stage the files you are committing with `git add [files]`.
4. Run `yarn commit`. This will start an interactive prompt that generates your commit message:
1. Select the type of change.
2. Type the scope. This is either `global` for project-wide changes or one of the packages (kibbeh, shawarma etc.).
Expand Down Expand Up @@ -48,14 +48,14 @@ Do this if you only want to do React stuff and don't want to touch Elixir:
Navigate to `/kibbeh`

- Run `yarn`
- Run `yarn staging` (this tells React to connect to a hosted version of the backend for development purposes)
- Read `kibbeh/README.md` for more information and a fixes for known development issues.
- Run `yarn staging` (this tells React to connect to a hosted version of the backend for development purposes).
- Read `kibbeh/README.md` for more information and fixes for known development issues.
> **NOTE:** Please follow the [design guidelines](https://github.com/benawad/dogehouse/blob/staging/DESIGN_GUIDELINES.md) and [figma mockups](https://www.figma.com/file/CS01VVLR7ArQl0afYFkNj3/Web-App) and if what you're trying to do isn't in there, consult [@ajmnz](https://github.com/ajmnz)/[@benawad](https://github.com/benawad) beforehand.
## Translating
1. Set up the front-end (previous step).
2. Go to `kibbeh/public/locales`.
3. Check if a folder with the language you want to add / edit already exists. If not, copy `en/translation`, create the folder and paste it there.
3. Check if a folder with the language you want to add/ edit already exists. If not, copy `en/translation`, create the folder and paste it there.
4. Edit the JSON file. Make sure that it's valid.
5. Go to `kibbeh/src/ui/LanguageSelector.tsx` and edit the object to include your language.
6. Test and make a pull request.
Expand All @@ -67,7 +67,7 @@ Navigate to `/kibbeh`
4. Run `yarn i18` to generate all fields into all other `translation.json`.

## Devcontainer Full Local Development
For VSCode users, we're able to use devcontainers which allows to create development environments that already have all the tools and services configured and ready to go.
For VSCode users, we're able to use devcontainers which allows you to create development environments that already have all the tools and services configured and ready to go.

### Usage

Expand Down
66 changes: 33 additions & 33 deletions kibbeh/public/locales/de/translation.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

{
"_comment": "if you change this file, do: yarn i18",
"common": {
Expand All @@ -16,13 +17,13 @@
"copied": "kopiert",
"formattedIntlDate": "{{date, intlDate}}",
"formattedIntlTime": "{{time, intlTime}}",
"requestPermissions": "Bitte erteile DogeHouse Browserpermissions."
"requestPermissions": "Bitte erteile DogeHouse Browserberechtigungen."
},
"header": {
"_comment": "Main Header UI Internationalization Strings",
"title": "DogeHouse",
"mutedTitle": "Stumm | DogeHouse",
"deafenedTitle": "Deafened | DogeHouse",
"deafenedTitle": "Lautsprecher stumm | DogeHouse",
"dashboard": "Dashboard",
"connectionTaken": "Verbindung getrennt"
},
Expand Down Expand Up @@ -73,8 +74,7 @@
"soundSettings": "Soundeinstellungen",
"deleteAccount": "Konto löschen",
"overlaySettings": "Overlay-Einstellungen löschen",
"couldNotFindUser": "Wir konnten diesen Benutzer leider nicht finden. ",
"privacySettings": "Privacy settings"
"couldNotFindUser": "Wir konnten diesen Benutzer leider nicht finden. "
},
"notFound": {
"whoopsError": "Hoppla! Diese Seite ging im Gespräch verloren.",
Expand All @@ -89,10 +89,10 @@
"allowAllConfirm": "Bist du sicher? Damit erteilst du {{count}} Benutzern Redeberechtigungen."
},
"searchUser": { "search": "Suchen..." },
"soundEffectSettings": { "header": "Ton", "title": "Sound Settings" },
"soundEffectSettings": { "header": "Ton", "title": "Toneinstellungen" },
"viewUser": {
"editProfile": "Profil bearbeiten",
"followsYou": "folgt dir",
"followsYou": "Folgt dir",
"following": "Abonniert",
"followers": "Abonnenten",
"followHim": "Folgen",
Expand Down Expand Up @@ -134,7 +134,7 @@
"avatar": {},
"backBar": {},
"blockedFromRoomUsers": {
"header": "blockierte Benutzer",
"header": "Blockierte Benutzer",
"unban": "Blockierung aufheben",
"noBans": "Du hast aktuell (noch) niemanden blockiert"
},
Expand All @@ -158,18 +158,18 @@
},
"micPermissionBanner": {
"permissionDenied": "Wir haben keinen Zugriff auf dein Mikrofon. Öffne deine Browsereinstellungen, setze die nötigen Berechtigungen und lade die Seite erneut.",
"dismiss": "verstanden",
"tryAgain": "erneut versuchen"
"dismiss": "Verstanden",
"tryAgain": "Erneut versuchen"
},
"modals": {
"createRoomModal": {
"public": "Öffentlich",
"private": "Privat",
"roomName": "Raumname",
"roomDescription": "Raumbeschreibung",
"descriptionError": "die maximale Länge beträgt 500 Zeichen",
"nameError": "muss zwischen 2 und 60 Zeichen lang sein",
"subtitle": "Fill the following fields to start a new room"
"descriptionError": "Die maximale Länge beträgt 500 Zeichen",
"nameError": "Muss zwischen 2 und 60 Zeichen lang sein",
"subtitle": "Fülle die folgenden Felder aus, um einen Raum zu erstellen"
},
"invitedToJoinRoomModal": {
"newRoomCreated": "Neuen Raum erstellt",
Expand All @@ -180,28 +180,28 @@
},
"editProfileModal": {
"usernameTaken": "Benutzername ist bereits vergeben",
"avatarUrlError": "ungültiges Bild",
"avatarUrlError": "Ungültiges Bild",
"avatarUrlLabel": "GitHub / Twitter Avatar URL",
"displayNameError": "Länge: 2 bis 50 Buchstaben",
"displayNameLabel": "Anzeigename",
"usernameError": "Länge: 4 bis 15 alphanumerische Zeichen und Unterstriche",
"usernameLabel": "Benutzername",
"bioError": "Maximal 160 Buchstaben",
"bioLabel": "Bio",
"bannerUrlLabel": "Twitter banner URL"
"bioLabel": "Biografie",
"bannerUrlLabel": "Twitter Banner URL"
},
"profileModal": {
"blockUserConfirm": "Bist du sicher, dass du diesen Benutzer aus allen deinen zukünftigen Räumen ausschließen möchtest?",
"blockUser": "Benutzer blockieren",
"makeMod": "Zum Moderator befördern",
"unmod": "Moderator Status aufheben",
"addAsSpeaker": "zu Sprecher befördern",
"moveToListener": "zu Zuhörer herabstufen",
"addAsSpeaker": "Zu Sprecher befördern",
"moveToListener": "Zu Zuhörer herabstufen",
"banFromChat": "Im Chat blockieren",
"banFromRoom": "Aus Raum ausschließen",
"goBackToListener": "Zurück zum Zuhörer",
"deleteMessage": "Nachricht löschen",
"makeRoomCreator": "zum Raumadmin befördern",
"makeRoomCreator": "Zum Raumadmin befördern",
"unBanFromChat": "Vom Chat entbannen"
},
"roomSettingsModal": {
Expand All @@ -210,7 +210,7 @@
"makePrivate": "Raum privat machen",
"renamePublic": "Öffentlichen Raum-Namen setzen",
"renamePrivate": "Privaten Raum-Namen setzen",
"chatDisabled": "disable chat"
"chatDisabled": "Chat ausschalten"
}
},
"userVolumeSlider": {
Expand All @@ -234,17 +234,17 @@
"addSupport": "erstellen und ich werde versuchen, die Unterstützung für dein Gerät hinzuzufügen."
},
"inviteButton": {
"invited": "eingeladen",
"inviteToRoom": "zum Raum einladen"
"invited": "Eingeladen",
"inviteToRoom": "Zum Raum einladen"
},
"followingOnline": {
"people": "People",
"people": "Leute",
"online": "ONLINE",
"noOnline": "Aktuell sind keine deiner Freunde online.",
"showMore": "Zeige mehr"
},
"upcomingRoomsCard": {
"upcomingRooms": "Kommende Räume",
"upcomingRooms": "Anstehende Räume",
"exploreMoreRooms": "Finde weitere Räume"
},
"search": {
Expand All @@ -261,7 +261,7 @@
"modalSubtitle": "Möchtest du dich wirklich abmelden?"
},
"debugAudio": {
"debugAudio": "Debug Audio",
"debugAudio": "Ton debuggen",
"stopDebugger": "Stoppe Debugger"
},
"downloadApp": "App herunterladen"
Expand All @@ -282,15 +282,15 @@
"minLength": "minimale Länge: 2",
"roomDescription": "Raumbeschreibung"
},
"tommorow": "morgen",
"today": "heute",
"tommorow": "Morgen",
"today": "Heute",
"deleteModal": {
"areYouSure": "Möchtest du diesen geplanten Raum wirklich löschen?"
}
},
"roomChat": {
"title": "Chat",
"emotesSoon": "[emotes bald]",
"emotesSoon": "[emotes kommen bald]",
"bannedAlert": "Du wurdest aus dem Chat ausgeschlossen",
"waitAlert": "Du musst eine Sekunde warten, bevor du eine weitere Nachricht schreiben kannst",
"search": "Suchen",
Expand All @@ -300,19 +300,19 @@
"whisper": "Flüstern",
"welcomeMessage": "Willkommen im Chat!",
"roomDescription": "Raumbeschreibung",
"disabled": "room chat has been disabled"
"disabled": "Der Chat wurde vom Raum ausgeschaltet"
},
"roomStatus": {
"fuelingRocket": "Rakete wird getankt",
"fuelingRocket": "Rakete wird getankt!",
"takingOff": "Am Abheben",
"inSpace": "Im Weltall",
"approachingMoon": "Nähert sich dem Mond",
"approachingMoon": "Nähert sich dem Mond!",
"lunarDoge": "Lunar doge",
"approachingSun": "Nähert sich der Sonne",
"approachingSun": "Nähert sich der Sonne!",
"solarDoge": "Solar doge",
"approachingGalaxy": "Nähert sich einer Galaxie",
"approachingGalaxy": "Nähert sich einer Galaxie!",
"galacticDoge": "Galactic Doge",
"spottedLife": "Planet mit Leben gefunden"
"spottedLife": "Planet mit Leben gefunden!"
},
"feed": { "yourFeed": "Dein Feed" }
}
Expand Down
4 changes: 2 additions & 2 deletions kibbeh/src/shared-hooks/useMainWsHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const useMainWsHandler = () => {
);
}
),
conn.addListener<any>("mod_changed", ({ userId, roomId }) => {
conn.addListener<any>("mod_changed", ({ userId, roomId, isMod }) => {
updateQuery(["joinRoomAndGetInfo", roomId], (data) =>
!data || "error" in data
? data
Expand All @@ -267,7 +267,7 @@ export const useMainWsHandler = () => {
...x,
roomPermissions: mergeRoomPermission(
x.roomPermissions,
{ isMod: !x.roomPermissions?.isMod }
{ isMod }
),
}
: x
Expand Down
12 changes: 12 additions & 0 deletions kousa/lib/broth/message/user/update.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ defmodule Broth.Message.User.Update do
:whisperPrivacySetting
])
|> validate_required([:username])
|> update_change(:displayName, &String.trim/1)
|> validate_length(:bio, min: 0, max: 160)
|> validate_length(:displayName, min: 2, max: 50)
|> validate_format(:username, ~r/^[\w\.]{4,15}$/)
|> validate_format(
:avatarUrl,
~r/^https?:\/\/(www\.|)((a|p)bs.twimg.com\/(profile_images|sticky\/default_profile_images)\/(.*)\.(jpg|png|jpeg|webp)|avatars\.githubusercontent\.com\/u\/[^\s]+|github.com\/identicons\/[^\s]+|cdn.discordapp.com\/avatars\/[^\s]+\/[^\s]+\.(jpg|png|jpeg|webp))/
)
|> validate_format(
:bannerUrl,
~r/^https?:\/\/(www\.|)(pbs.twimg.com\/profile_banners\/(.+)\/(.+)\/(.+)(?:\.(jpg|png|jpeg|webp))?|avatars\.githubusercontent\.com\/u\/)/
)
|> unique_constraint(:username)
end

Expand Down
19 changes: 19 additions & 0 deletions kousa/test/broth/user/update_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ defmodule BrothTest.User.UpdateTest do
"https://pbs.twimg.com/profile_images/1152793238761345024/VRBvxeCM_400x400.jpg"
end

test "a bad avatar", t do
user_id = t.user.id

ref =
WsClient.send_call(
t.client_ws,
"user:update",
%{
"avatarUrl" => "https://bob.example.com/"
}
)

WsClient.assert_error("user:update", ref, %{"avatarUrl" => "has invalid format"})

user = Users.get_by_id(user_id)

assert user.avatarUrl == t.user.avatarUrl
end

@tag :skip
test "when you have two websockets connected updating one propagates change to other"

Expand Down

2 comments on commit a91c531

@vercel
Copy link

@vercel vercel bot commented on a91c531 May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on a91c531 May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.