Skip to content

Commit

Permalink
Merge branch 'master' into subtype
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Dec 31, 2023
2 parents 3679761 + 09811d3 commit 9898e91
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:22.04 as builder
SHELL ["bash", "-c"]

ARG git_commit_id
ARG rust_version=1.73.0
ARG rust_version=1.75.0

ENV GIT_COMMIT_ID=$git_commit_id
ENV TZ=UTC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ async fn make_payment(ledger_canister: CanisterId, transfer_args: TransferArg) -

fn memo(reason: PendingPaymentReason) -> Memo {
match reason {
PendingPaymentReason::AccessGate => MEMO_JOINING_FEE.to_vec().try_into().unwrap(),
PendingPaymentReason::AccessGate => MEMO_JOINING_FEE.to_vec().into(),
}
}
2 changes: 0 additions & 2 deletions backend/canisters/cycles_dispenser/api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
mod lifecycle;
mod queries;
mod updates;

pub use lifecycle::*;
pub use queries::*;
pub use updates::*;
1 change: 0 additions & 1 deletion backend/canisters/cycles_dispenser/api/src/queries/mod.rs

This file was deleted.

2 changes: 0 additions & 2 deletions backend/canisters/escrow/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ use sha256::sha256;
use types::UserId;

mod lifecycle;
mod queries;
mod updates;

pub use lifecycle::*;
pub use queries::*;
pub use updates::*;

pub fn deposit_subaccount(user_id: UserId, offer_id: u32) -> Subaccount {
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/escrow/api/src/queries/mod.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ async fn make_payment(ledger_canister: CanisterId, transfer_args: TransferArg) -

fn memo(reason: PendingPaymentReason) -> Memo {
match reason {
PendingPaymentReason::AccessGate => MEMO_JOINING_FEE.to_vec().try_into().unwrap(),
PendingPaymentReason::AccessGate => MEMO_JOINING_FEE.to_vec().into(),
}
}
2 changes: 0 additions & 2 deletions backend/canisters/neuron_controller/api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
mod lifecycle;
mod queries;
mod updates;

pub use lifecycle::*;
pub use queries::*;
pub use updates::*;
1 change: 0 additions & 1 deletion backend/canisters/neuron_controller/api/src/queries/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion backend/canisters/proposals_bot/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fn generate_message_id(governance_canister_id: CanisterId, proposal_id: Proposal
hash.update(b"proposals_bot");
hash.update(governance_canister_id.as_slice());
hash.update(proposal_id.to_ne_bytes());
let array32: [u8; 32] = hash.finalize().try_into().unwrap();
let array32: [u8; 32] = hash.finalize().into();
let array16: [u8; 16] = array32[..16].try_into().unwrap();
u128::from_ne_bytes(array16).into()
}
4 changes: 4 additions & 0 deletions backend/canisters/user/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Changed

- Add `local_user_index_canister_id` to `initial_state` response ([#5083](https://github.com/open-chat-labs/open-chat/pull/5083))

### Removed

- Remove group summary cache ([#5067](https://github.com/open-chat-labs/open-chat/pull/5067))
Expand Down
1 change: 1 addition & 0 deletions backend/canisters/user/api/can.did
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ type InitialStateResponse = variant {
avatar_id : opt nat;
blocked_users : vec UserId;
suspended : bool;
local_user_index_canister_id : CanisterId;
};
};

Expand Down
3 changes: 2 additions & 1 deletion backend/canisters/user/api/src/queries/initial_state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use candid::CandidType;
use serde::{Deserialize, Serialize};
use types::{Chat, ChatId, DirectChatSummary, Empty, GroupChatSummary, TimestampMillis, UserId};
use types::{CanisterId, Chat, ChatId, DirectChatSummary, Empty, GroupChatSummary, TimestampMillis, UserId};

pub type Args = Empty;

Expand All @@ -19,6 +19,7 @@ pub struct SuccessResult {
pub avatar_id: Option<u128>,
pub blocked_users: Vec<UserId>,
pub suspended: bool,
pub local_user_index_canister_id: CanisterId,
}

#[derive(CandidType, Serialize, Deserialize, Debug)]
Expand Down
1 change: 1 addition & 0 deletions backend/canisters/user/impl/src/queries/initial_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ fn initial_state_impl(state: &RuntimeState) -> Response {
avatar_id,
blocked_users,
suspended: state.data.suspended.value,
local_user_index_canister_id: state.data.local_user_index_canister_id,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async fn make_payment(pending_payment: &PendingPayment) -> Result<BlockIndex, bo
to: pending_payment.recipient_account,
fee: None,
created_at_time: Some(pending_payment.timestamp),
memo: Some(pending_payment.memo.to_vec().try_into().unwrap()),
memo: Some(pending_payment.memo.to_vec().into()),
amount: pending_payment.amount.into(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn get_batched_events_succeeds() {
},
);

assert_is_message_with_text(responses.get(0).unwrap(), "User: 0");
assert_is_message_with_text(responses.first().unwrap(), "User: 0");
assert_is_message_with_text(responses.get(1).unwrap(), "Group1: 1");
assert_is_message_with_text(responses.get(2).unwrap(), "Group2: 2");
assert_is_message_with_text(responses.get(3).unwrap(), "Channel: 3");
Expand Down Expand Up @@ -123,13 +123,13 @@ fn get_batched_summaries_succeeds() {
},
);

assert_is_summary_with_id(responses.get(0).unwrap(), group_id1.into(), false);
assert_is_summary_with_id(responses.first().unwrap(), group_id1.into(), false);
assert_is_summary_with_id(responses.get(1).unwrap(), group_id2.into(), false);
assert_is_summary_with_id(responses.get(2).unwrap(), community_id.into(), true);
}

fn assert_is_message_with_text(response: &EventsResponse, text: &str) {
if let local_user_index_canister::chat_events::EventsResponse::Success(result) = response {
if let EventsResponse::Success(result) = response {
assert_eq!(result.events.len(), 1);
if let ChatEvent::Message(message) = &result.events.first().unwrap().event {
assert_eq!(message.content.text().unwrap(), text);
Expand Down
2 changes: 1 addition & 1 deletion backend/libraries/candid_gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn generate_candid_method_no_args(input: TokenStream) -> TokenStream {
}

fn get_method_attribute(inputs: Vec<String>) -> MethodAttribute {
let first_arg = inputs.get(0).unwrap();
let first_arg = inputs.first().unwrap();
let second_arg = inputs.get(1).unwrap();
let third_arg = inputs.get(2).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion backend/libraries/canister_api_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn get_arg_names(signature: &Signature) -> Vec<Ident> {
}

fn get_validation_method_attribute(inputs: Vec<String>) -> ValidationMethodAttribute {
let service_name = inputs.get(0).unwrap().to_string();
let service_name = inputs.first().unwrap().to_string();
let function_name = inputs.get(1).unwrap().to_string();

ValidationMethodAttribute {
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/src/i18n/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@
"communities": "社区",
"selectCommunity": "选择一个社区",
"global": "全球的",
"block": "堵塞",
"unblock": "解锁"
"block": "屏蔽",
"unblock": "取消屏蔽"
},
"undeleteMessage": "取消删除",
"undeletingMessage": "{username} 在 {timestamp} 上取消删除消息",
Expand Down Expand Up @@ -1208,4 +1208,4 @@
"quoteTooLow": "所报的最佳费率是 {rate} {tokenOut} / {tokenIn} @{dex}。这将从 {amountIn} {tokenIn} 兑换 {amountOut} {tokenOut} 。仅当报价金额超过 {minAmountOut} 时,您才可以进行交换。"
},
"messageBlocked": "消息已隐藏"
}
}
4 changes: 2 additions & 2 deletions frontend/openchat-client/src/openchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2349,9 +2349,9 @@ export class OpenChat extends OpenChatAgentWorker {
return Promise.resolve();
}

const context = this._liveState.selectedMessageContext;
const context = { chatId, threadRootMessageIndex };

if (context?.threadRootMessageIndex === undefined) return;
if (!messageContextsEqual(context, this._liveState.selectedMessageContext)) return;

const eventsResponse = await this.sendRequest({
kind: "chatEvents",
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.73.0"
channel = "1.75.0"
targets = ["wasm32-unknown-unknown"]

0 comments on commit 9898e91

Please sign in to comment.