Skip to content

Commit

Permalink
fix: Use bio_markdown instead of description for SocialDB profile des…
Browse files Browse the repository at this point in the history
…cription (#99)
  • Loading branch information
frol authored Mar 2, 2024
1 parent f45a405 commit 29031c9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
19 changes: 12 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,11 @@ impl Contract {

require!(
self.has_moderator(editor_id.clone())
|| editor_id.clone() == env::current_account_id()
|| current_timeline.is_draft()
&& (proposal_body.timeline.is_empty_review()
|| proposal_body.timeline.is_draft())
|| current_timeline.can_be_cancelled() && proposal_body.timeline.is_cancelled(),
|| editor_id.clone() == env::current_account_id()
|| current_timeline.is_draft()
&& (proposal_body.timeline.is_empty_review()
|| proposal_body.timeline.is_draft())
|| current_timeline.can_be_cancelled() && proposal_body.timeline.is_cancelled(),
"This account is only allowed to change proposal status from DRAFT to REVIEW"
);

Expand Down Expand Up @@ -827,7 +827,8 @@ impl Contract {
require!(community.handle == handle, "Community handle cannot be changed");
require!(env::prepaid_gas() >= UPDATE_COMMUNITY_GAS, "Require at least 30 Tgas");
self.communities.insert(&handle, &community);
let community_page_link = format!("/devhub.near/widget/app?page=community&handle={}", community.handle);
let community_page_link =
format!("/devhub.near/widget/app?page=community&handle={}", community.handle);
social_db_contract().with_unused_gas_weight(1).set(json!({
get_devhub_community_account(&community.handle): {
"profile": {
Expand All @@ -841,7 +842,11 @@ impl Contract {
"telegram": community.telegram_handle,
"website": format!("near.social{community_page_link}"),
},
"description": format!("{}\n\nLearn more about our community [on DevHub]({}).", community.description, community_page_link),
"description": format!(
"{}\n\nLearn more about our community [on DevHub]({}).",
community.bio_markdown.as_ref().unwrap_or(&community.description),
community_page_link
),
"backgroundImage": {
"url": community.banner_url,
},
Expand Down
2 changes: 1 addition & 1 deletion src/proposal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ pub enum ProposalFundingCurrency {
USDT,
USDC,
OTHER,
}
}
8 changes: 5 additions & 3 deletions tests/test_env.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use near_sdk::{NearToken, AccountIdRef};
use near_sdk::{AccountIdRef, NearToken};
use near_workspaces::network::Sandbox;
use near_workspaces::types::{AccessKey, KeyType, SecretKey};
use near_workspaces::{Account, Worker};
Expand All @@ -7,13 +7,15 @@ use serde_json::json;

const DEVHUB_CONTRACT_PREFIX: &str = "devhub";
const DEVHUB_CONTRACT: &AccountIdRef = AccountIdRef::new_or_panic("devhub.near");
const DEVHUB_COMMUNITY_CONTRACT: &AccountIdRef = AccountIdRef::new_or_panic("community.devhub.near");
const DEVHUB_COMMUNITY_CONTRACT: &AccountIdRef =
AccountIdRef::new_or_panic("community.devhub.near");
const COMMUNITY_FACTORY_PREFIX: &str = "community";
const NEAR_SOCIAL: &AccountIdRef = AccountIdRef::new_or_panic("social.near");
const _TEST_NEAR_SOCIAL: &AccountIdRef = AccountIdRef::new_or_panic("v1.social08.testnet");
const TEST_SEED: &str = "testificate";
const DEVHUB_CONTRACT_PATH: &str = "./target/near/devhub.wasm";
const COMMUNITY_FACTORY_CONTRACT_PATH: &str = "./community-factory/target/near/devhub_community_factory.wasm";
const COMMUNITY_FACTORY_CONTRACT_PATH: &str =
"./community-factory/target/near/devhub_community_factory.wasm";

#[allow(dead_code)]
pub async fn init_contracts_from_mainnet() -> anyhow::Result<near_workspaces::Contract> {
Expand Down

0 comments on commit 29031c9

Please sign in to comment.