Skip to content

Commit

Permalink
Merge branch 'master' into emoji-thread
Browse files Browse the repository at this point in the history
  • Loading branch information
julianjelfs authored Dec 5, 2023
2 parents 576c591 + 0d8b42c commit cdad125
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 106 deletions.
2 changes: 2 additions & 0 deletions backend/canisters/community/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.958](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.958-community)] - 2023-12-05

### Added

- Add `c2c_send_message` with improved API for c2c calls vs `send_message` ([#4895](https://github.com/open-chat-labs/open-chat/pull/4895))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ pub struct Args {
pub ledger: CanisterId,
pub token: Cryptocurrency,
pub amount: u128,
#[serde(default = "eight")]
pub decimals: u8,
pub username: String,
pub display_name: Option<String>,
}

fn eight() -> u8 {
8
}

#[derive(CandidType, Serialize, Deserialize, Debug)]
pub enum Response {
Success,
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/group/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.957](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.957-group)] - 2023-12-05

### Added

- Add `c2c_send_message` with improved API for c2c calls vs `send_message_v2` ([#4895](https://github.com/open-chat-labs/open-chat/pull/4895))
Expand Down
5 changes: 0 additions & 5 deletions backend/canisters/group/api/src/updates/c2c_tip_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@ pub struct Args {
pub ledger: CanisterId,
pub token: Cryptocurrency,
pub amount: u128,
#[serde(default = "eight")]
pub decimals: u8,
pub username: String,
pub display_name: Option<String>,
}

fn eight() -> u8 {
8
}

#[derive(CandidType, Serialize, Deserialize, Debug)]
pub enum Response {
Success,
Expand Down
6 changes: 6 additions & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.959](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.959-local_user_index)] - 2023-12-05

### Added

- Introduce `Lifetime Diamond Membership` ([#4876](https://github.com/open-chat-labs/open-chat/pull/4876))

### Changed

- Remove `display_name` from `register_user` args ([#4910](https://github.com/open-chat-labs/open-chat/pull/4910))
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/proposals_bot/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.960](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.960-proposals_bot)] - 2023-12-05

### Changed

- Avoid reseeding random number generator after each upgrade ([#4755](https://github.com/open-chat-labs/open-chat/pull/4755))
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/proposals_bot/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ struct Data {
pub timer_jobs: TimerJobs<TimerJob>,
pub registry_synced_up_to: TimestampMillis,
pub fire_and_forget_handler: FireAndForgetHandler,
#[serde(default)]
pub rng_seed: [u8; 32],
pub test_mode: bool,
}
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/user/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.961](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.961-user)] - 2023-12-05

### Added

- Support getting batches of chat events via LocalUserIndex ([#4848](https://github.com/open-chat-labs/open-chat/pull/4848))
Expand Down
5 changes: 0 additions & 5 deletions backend/canisters/user/api/src/updates/c2c_tip_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ pub struct Args {
pub ledger: CanisterId,
pub token: Cryptocurrency,
pub amount: u128,
#[serde(default = "eight")]
pub decimals: u8,
pub username: String,
pub display_name: Option<String>,
pub user_avatar_id: Option<u128>,
}

fn eight() -> u8 {
8
}

#[derive(CandidType, Serialize, Deserialize, Debug)]
pub enum Response {
Success,
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.955](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.955-user_index)] - 2023-12-05

### Added

- Expose count of new users per day ([#4873](https://github.com/open-chat-labs/open-chat/pull/4873))
Expand Down
6 changes: 0 additions & 6 deletions backend/canisters/user_index/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,22 +216,16 @@ struct Data {
pub local_index_map: LocalUserIndexMap,
pub timer_jobs: TimerJobs<TimerJob>,
pub neuron_controllers_for_initial_airdrop: HashMap<UserId, Principal>,
#[serde(default = "nns_governance_canister_id")]
pub nns_governance_canister_id: CanisterId,
pub internet_identity_canister_id: CanisterId,
pub user_referral_leaderboards: UserReferralLeaderboards,
pub platform_moderators_group: Option<ChatId>,
pub reported_messages: ReportedMessages,
pub fire_and_forget_handler: FireAndForgetHandler,
#[serde(default)]
pub nns_8_year_neuron: Option<NnsNeuron>,
pub rng_seed: [u8; 32],
}

fn nns_governance_canister_id() -> CanisterId {
CanisterId::from_text("rrkah-fqaaa-aaaaa-aaaaq-cai").unwrap()
}

impl Data {
#[allow(clippy::too_many_arguments)]
pub fn new(
Expand Down
14 changes: 1 addition & 13 deletions backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::{mutate_state, Data, NnsNeuron};
use crate::Data;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk_macros::post_upgrade;
Expand All @@ -23,17 +23,5 @@ fn post_upgrade(args: Args) {
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
init_state(env, data, args.wasm_version);

mutate_state(|state| {
if !state.data.test_mode {
state.data.nns_8_year_neuron = Some(NnsNeuron {
neuron_id: 17682165960669268263,
subaccount: [
106, 24, 201, 114, 207, 210, 101, 85, 190, 208, 248, 112, 144, 208, 19, 164, 28, 86, 155, 119, 164, 16, 3,
35, 254, 181, 161, 84, 24, 147, 57, 111,
],
});
}
});

info!(version = %args.wasm_version, "Post-upgrade complete");
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use utils::time::DAY_IN_MS;
const LIFETIME_TIMESTAMP: TimestampMillis = 30000000000000; // This timestamp is in the year 2920

#[derive(Serialize, Deserialize, Clone, Default)]
#[serde(from = "DiamondMembershipDetailsInternalCombined")]
pub struct DiamondMembershipDetailsInternal {
expires_at: Option<TimestampMillis>,
payments: Vec<DiamondMembershipPayment>,
Expand All @@ -18,39 +17,6 @@ pub struct DiamondMembershipDetailsInternal {
payment_in_progress: bool,
}

#[derive(Serialize, Deserialize, Clone, Default)]
pub struct DiamondMembershipDetailsInternalCombined {
expires_at: Option<TimestampMillis>,
payments: Vec<DiamondMembershipPayment>,
#[serde(default)]
pay_in_chat: bool,
#[serde(default)]
subscription: Option<DiamondMembershipSubscription>,
#[serde(default)]
recurring: bool,
payment_in_progress: bool,
}

impl From<DiamondMembershipDetailsInternalCombined> for DiamondMembershipDetailsInternal {
fn from(value: DiamondMembershipDetailsInternalCombined) -> Self {
let subscription = value.subscription.unwrap_or_else(|| {
if value.recurring {
value.payments.last().map(|p| p.duration.into()).unwrap_or_default()
} else {
DiamondMembershipSubscription::Disabled
}
});

DiamondMembershipDetailsInternal {
expires_at: value.expires_at,
payments: value.payments,
pay_in_chat: value.pay_in_chat,
subscription,
payment_in_progress: value.payment_in_progress,
}
}
}

#[derive(Serialize, Deserialize, Clone)]
pub struct DiamondMembershipPayment {
pub timestamp: TimestampMillis,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use candid::Principal;
use icrc_ledger_types::icrc1::account::Account;
use serde::{Deserialize, Serialize};
use std::collections::VecDeque;
Expand All @@ -24,7 +23,6 @@ impl PendingPaymentsQueue {
}

#[derive(Serialize, Deserialize)]
#[serde(from = "PendingPaymentCombined")]
pub struct PendingPayment {
pub amount: u64,
pub currency: Cryptocurrency,
Expand All @@ -34,35 +32,6 @@ pub struct PendingPayment {
pub reason: PendingPaymentReason,
}

#[derive(Serialize, Deserialize)]
pub struct PendingPaymentCombined {
pub amount: u64,
pub currency: Cryptocurrency,
pub timestamp: TimestampNanos,
#[serde(default)]
pub recipient_account: Option<Account>,
#[serde(default)]
pub recipient: Option<Principal>,
pub memo: [u8; 32],
pub reason: PendingPaymentReason,
}

impl From<PendingPaymentCombined> for PendingPayment {
fn from(value: PendingPaymentCombined) -> Self {
PendingPayment {
amount: value.amount,
currency: value.currency,
timestamp: value.timestamp,
recipient_account: value
.recipient_account
.or_else(|| value.recipient.map(Account::from))
.unwrap(),
memo: value.memo,
reason: value.reason,
}
}
}

#[derive(Serialize, Deserialize, Clone)]
pub enum PendingPaymentReason {
Treasury,
Expand Down
12 changes: 6 additions & 6 deletions canister_commit_ids.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"community": "303772e423d400a4417b6e3141205d17eb5f7a23",
"community": "81a9224803dd521cbbc46e99f27d673d2298bd65",
"cycles_dispenser": "496fd2aa54d194c29a7ba014ee1b6d7d1a2f9a00",
"group": "303772e423d400a4417b6e3141205d17eb5f7a23",
"group": "81a9224803dd521cbbc46e99f27d673d2298bd65",
"group_index": "f61321c254e82bb07646160b9ca0fc5dd0a759ea",
"local_group_index": "bfb8dc5b93c36c34f21e88b52c36ad5d30b68e09",
"local_user_index": "303772e423d400a4417b6e3141205d17eb5f7a23",
"local_user_index": "f886c1630c5790e6518077d7b1fa8f85906f3fb2",
"market_maker": "9a6a38f86194b57dc8718c2a595ef4b00cf82d47",
"neuron_controller": "70cd194427a9eb48972ae8924b6e8a6be74199f4",
"notifications": "b72fb44d4d34c1b9f34dc6eb650144944b57860a",
"notifications_index": "b72fb44d4d34c1b9f34dc6eb650144944b57860a",
"online_users": "9a6a38f86194b57dc8718c2a595ef4b00cf82d47",
"proposals_bot": "45d105cb2e7b10198102f940c3a2a12953ef3f82",
"proposals_bot": "23c4e18dfa32ad868ebf3588bd821d7c0d68d008",
"proposal_validation": "03647d5475bd4cb1b6299c5688e6d4f97928559a",
"registry": "ce3033cea45ce8aa6647c3124d7b99b94caa00c4",
"storage_bucket": "5c4fb8d98e68053c6d93050dfafbd2dbb4c3c9b9",
"storage_index": "8426b83456957cdc997374c8a01d9b641d1d3d08",
"user": "e38e72c517886c34b81626e791e5669acdc7acbb",
"user_index": "f61321c254e82bb07646160b9ca0fc5dd0a759ea"
"user": "23c4e18dfa32ad868ebf3588bd821d7c0d68d008",
"user_index": "eac89bc6da516a50dd54d94762efb86d468b7781"
}

0 comments on commit cdad125

Please sign in to comment.