-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(trade): Block users from trading with an old app version #2174
Changes from all commits
59ec60e
226ddd0
cd8a770
c6d1836
7a54139
bb70acb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -63,12 +63,22 @@ jobs: | |||||
run: | | ||||||
cargo set-version --package webapp ${{ github.event.inputs.version }} | ||||||
|
||||||
- name: Commit changelog and manifest files | ||||||
- name: Bump mobile/native Cargo.toml version | ||||||
uses: stellar/binaries@v13 | ||||||
with: | ||||||
name: cargo-edit | ||||||
version: 0.11.6 | ||||||
- id: set-mobile-version | ||||||
continue-on-error: true | ||||||
run: | | ||||||
cargo set-version --package mobile/native ${{ github.event.inputs.version }} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ At least locally this does not work.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙈 I tested it locally with a different command. Thanks for the fix 🙂 |
||||||
|
||||||
- name: Commit manifest files | ||||||
id: make-commit | ||||||
run: | | ||||||
/home/runner/.dprint/bin/dprint fmt | ||||||
|
||||||
git add mobile/pubspec.yaml coordinator/Cargo.toml webapp/Cargo.toml | ||||||
git add mobile/native/Cargo.toml mobile/pubspec.yaml coordinator/Cargo.toml webapp/Cargo.toml Cargo.lock | ||||||
holzeis marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
git commit --message "Prepare release ${{ github.event.inputs.version }}" | ||||||
|
||||||
echo "::set-output name=commit::$(git rev-parse HEAD)" | ||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE users DROP COLUMN IF EXISTS "version"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE users ADD COLUMN "version" TEXT; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use crate::db; | ||
use crate::db::user::User; | ||
use anyhow::ensure; | ||
use anyhow::Context; | ||
use anyhow::Result; | ||
use bitcoin::secp256k1::PublicKey; | ||
use diesel::PgConnection; | ||
|
||
pub fn check_version(conn: &mut PgConnection, trader_id: &PublicKey) -> Result<()> { | ||
let user: User = db::user::get_user(conn, trader_id)?.context("Couldn't find user")?; | ||
|
||
let app_version = user.version.context("No version found")?; | ||
|
||
let coordinator_version = env!("CARGO_PKG_VERSION").to_string(); | ||
ensure!( | ||
app_version == coordinator_version, | ||
format!("Please upgrade to the latest version: {coordinator_version}") | ||
); | ||
|
||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "native" | ||
version = "0.1.0" | ||
version = "1.9.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This step already exists a few lines above