Skip to content

Commit

Permalink
Merge branch 'main' into rails6
Browse files Browse the repository at this point in the history
  • Loading branch information
tarebyte committed Aug 11, 2023
2 parents 047aa68 + 8b00c8c commit 538ec66
Show file tree
Hide file tree
Showing 17 changed files with 1,309 additions and 1,801 deletions.
35 changes: 9 additions & 26 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
FROM mcr.microsoft.com/devcontainers/base:jammy
ARG RUBY_VERSION

ENV DEBIAN_FRONTEND noninteractive
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
FROM mcr.microsoft.com/devcontainers/ruby:${RUBY_VERSION}

# disable installing recommended packages to save space
RUN echo "APT::Install-Recommends \"false\";" > /etc/apt/apt.conf
ARG NODE_VERSION
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"

RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get upgrade -y && \
apt-get install -y \
build-essential \
libffi-dev \
libjemalloc-dev \
apt-get install -y --no-install-recommends \
libpq-dev \
libreadline-dev \
libssl-dev \
libxml2-dev \
libxslt-dev \
libyaml-dev \
python2 \
shared-mime-info \
tmux \
zlib1g-dev && \
tmux && \
apt-get autoremove -y

# Install Overmind to run multiple processes at once.
Expand All @@ -31,16 +22,8 @@ RUN curl --fail --location --output /usr/bin/overmind.gz "https://github.com/Dar
gunzip /usr/bin/overmind.gz && \
chmod +x /usr/bin/overmind

# Run as the target user
# Uses the username created by the VSCode devcontainer Ubuntu base image
USER vscode
ENV USER=vscode

COPY ../.ruby-version /tmp/.ruby-version

RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv
RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
RUN ~/.rbenv/bin/rbenv install $(cat /tmp/.ruby-version)
RUN su vscode -c "gem install bundler:2.4.18"
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g yarn" 2>&1

ENV OVERMIND_SOCKET=/tmp/.overmind.sock

Expand Down
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "18"
},
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {
"plugins": "git npm nvm rbenv ssh-agent zsh-autosuggestions",
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ services:
build:
context: .
dockerfile: .devcontainer/Dockerfile
args:
RUBY_VERSION: 2.7
NODE_VERSION: 18.17

environment:
DATABASE_HOST: postgres
Expand Down
6 changes: 0 additions & 6 deletions .devcontainer/post-create-command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,4 @@ GOOGLE_ANALYTICS_ID="..."
EOT
fi

gem update bundler
rbenv rehash

npm update -g npm
npm install -g yarn

./bin/setup
7 changes: 2 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
"extends": [
"eslint-config-airbnb-base",
"plugin:vue/recommended",
"plugin:prettier/recommended",
"prettier/vue"
"plugin:prettier/recommended"
],

"plugins": ["prettier"],

"env": {
"browser": true
},
Expand All @@ -19,7 +16,7 @@
},

"parserOptions": {
"parser": "babel-eslint",
"parser": "@babel/eslint-parser"
},

"settings": {
Expand Down
60 changes: 26 additions & 34 deletions app/webpack/components/authentication/sign_in.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
<div class="mdl-card mdl-shadow--2dp firebaseui-container">
<form @submit.prevent="handleTermsAccept">
<div class="firebaseui-card-header">
<h1 class="firebaseui-title">
Notifications and Privacy Policy
</h1>
<h1 class="firebaseui-title">Notifications and Privacy Policy</h1>
</div>
<div class="firebaseui-card-content">
<div class="firebaseui-relative-wrapper">
Expand All @@ -55,12 +53,8 @@
<li class="mdl-list__item">
Announcements about Soul Medicine
</li>
<li class="mdl-list__item">
Updates about new courses
</li>
<li class="mdl-list__item">
Updates on existing courses
</li>
<li class="mdl-list__item">Updates about new courses</li>
<li class="mdl-list__item">Updates on existing courses</li>
</ul>

<label
Expand Down Expand Up @@ -98,15 +92,13 @@
</form>
</div>

<p class="mt-3 font-bold" style="font-size: 1.4em; text-align: center;">
<p class="mt-3 font-bold" style="font-size: 1.4em; text-align: center">
OR
</p>

<div class="mdl-card mdl-shadow--2dp firebaseui-container">
<div class="firebaseui-card-header">
<h1 class="firebaseui-title">
Reject and don't proceed
</h1>
<h1 class="firebaseui-title">Reject and don't proceed</h1>
</div>
<div class="firebaseui-card-content">
<div class="firebaseui-relative-wrapper">
Expand Down Expand Up @@ -142,7 +134,7 @@
</template>

<script>
import firebase from 'firebase/app';
import firebase from 'firebase/compat/app';
import 'firebase/auth';
import * as firebaseui from 'firebaseui';
import 'firebaseui/dist/firebaseui.css';
Expand All @@ -159,12 +151,12 @@ export default {
inlineFlow: {
type: Boolean,
required: false,
default: false
default: false,
},
continueUrl: {
type: String,
required: true
}
required: true,
},
},
data() {
return {
Expand All @@ -175,7 +167,7 @@ export default {
showVerificationStep: false,
showFailureText: false,
showInstructionalText: true,
idToken: null
idToken: null,
};
},
created() {
Expand All @@ -194,8 +186,8 @@ export default {
signInOptions: [
{
provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
requireDisplayName: true
}
requireDisplayName: true,
},
],
credentialHelper: firebaseui.auth.CredentialHelper.NONE,
callbacks: {
Expand All @@ -208,10 +200,10 @@ export default {
signInFailure(error) {
vm.handleError(error);
return null;
}
},
},
tosUrl: this.tosUrl,
privacyPolicyUrl: this.privacyPolicyUrl
privacyPolicyUrl: this.privacyPolicyUrl,
};
this.ui.start(this.$refs.firebaseAuthContainer, this.uiConfig);
},
Expand Down Expand Up @@ -240,11 +232,11 @@ export default {
vm.loading = true;
return user
.getIdToken(true)
.then(idToken => {
.then((idToken) => {
vm.idToken = idToken;
vm.serverSignIn(null);
})
.catch(error => {
.catch((error) => {
vm.handleError(error);
})
.finally(() => {
Expand All @@ -258,11 +250,11 @@ export default {
'/auth/callback',
{
firebase_token: this.idToken,
terms_accepted: termsAccepted
terms_accepted: termsAccepted,
},
{ headers: { 'X-CSRF-TOKEN': this.csrfToken } }
{ headers: { 'X-CSRF-TOKEN': this.csrfToken } },
)
.then(result => {
.then((result) => {
return this.afterServerSignIn(result.data);
})
.catch(this.afterFailedServerSignIn);
Expand Down Expand Up @@ -300,17 +292,17 @@ export default {
const actionCodeSettings =
data.last_course_id != null
? {
url: `${vm.continueUrl}/?last_course_id=${data.last_course_id}`
url: `${vm.continueUrl}/?last_course_id=${data.last_course_id}`,
}
: {
url: vm.continueUrl
url: vm.continueUrl,
};
return user
.sendEmailVerification(actionCodeSettings)
.then(() => {
return vm.clearFirebaseSession();
})
.catch(error => {
.catch((error) => {
vm.showVerificationStep = false;
vm.handleError(error);
});
Expand All @@ -333,7 +325,7 @@ export default {
return firebase
.auth()
.signOut()
.catch(error => {
.catch((error) => {
this.handleError(error);
});
},
Expand All @@ -359,7 +351,7 @@ export default {
Turbolinks.visit('/auth/sign_out');
window.open(
`mailto:team@soulmedicine.io?subject=Request Account Deletion&body=Request Deletion for ${user.displayName} (email address: ${user.email})`,
'_self'
'_self',
);
});
},
Expand Down Expand Up @@ -392,8 +384,8 @@ export default {
"Sorry, something went wrong when signing you in! We've been notified about this. Please try again later on.";
this.$rollbar.error('Unknown client-side sign in error', error);
}
}
}
},
},
};
</script>

Expand Down
2 changes: 1 addition & 1 deletion app/webpack/components/cookie_law/cookie_law.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
import CookieLaw from 'vue-cookie-law';
export default {
components: { CookieLaw }
components: { CookieLaw },
};
</script>
6 changes: 3 additions & 3 deletions app/webpack/components/leave_site/leave_site.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export default {
Turbolinks.visit('/auth/sign_out');
window.open('http://www.wikipedia.org/', '_newtab');
window.location.replace(
'https://www.google.com/search?tbm=isch&q=cute+baby+animal+memes'
'https://www.google.com/search?tbm=isch&q=cute+baby+animal+memes',
);
}
}
},
},
};
</script>
4 changes: 2 additions & 2 deletions app/webpack/components/mixins/csrfTokenMixin.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const csrfTokenMixin = {
data() {
return {
csrfToken: null
csrfToken: null,
};
},
created() {
this.csrfToken = document
.querySelector('meta[name="csrf-token"]')
.getAttribute('content');
}
},
};

export default csrfTokenMixin;
14 changes: 7 additions & 7 deletions app/webpack/components/mixins/firebaseAppMixin.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import firebase, { initializeApp } from 'firebase/app';
import firebase from 'firebase/compat/app';

const firebaseAppMixin = {
props: {
apiKey: {
type: String,
required: true
required: true,
},
projectId: {
type: String,
required: true
}
required: true,
},
},
created() {
if (!firebase.apps.length) {
this.firebaseConfig = {
apiKey: this.apiKey,
authDomain: `${this.projectId}.firebaseapp.com`,
projectId: this.projectId
projectId: this.projectId,
};
initializeApp(this.firebaseConfig);
firebase.initializeApp(this.firebaseConfig);
}
}
},
};

export default firebaseAppMixin;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import firebase from 'firebase/app';
import firebase from 'firebase/compat/app';

const firebaseAuthStateChangedMixin = {
created() {
Expand All @@ -10,7 +10,7 @@ const firebaseAuthStateChangedMixin = {
if (this.onAuthStateChangedSubscription) {
this.onAuthStateChangedSubscription();
}
}
},
};

export default firebaseAuthStateChangedMixin;
Loading

0 comments on commit 538ec66

Please sign in to comment.