Skip to content

Commit

Permalink
Fix errors for build with roles feature enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
  • Loading branch information
Arjentix committed Feb 23, 2022
1 parent 6d16fcc commit fbea893
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
6 changes: 3 additions & 3 deletions core/src/smartcontracts/isi/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ pub mod isi {
#[metrics(+"register_role")]
fn execute(
self,
authority: <Account as Identifiable>::Id,
_authority: <Account as Identifiable>::Id,
wsv: &WorldStateView<W>,
) -> Result<(), Self::Error> {
let role_id = role.object.id;
let role_id = self.object.id.clone();

wsv.modify_world(|world| {
world.roles.insert(role_id.clone(), role);
world.roles.insert(role_id.clone(), self.object);
Ok(RoleEvent::Created(role_id).into())
})
}
Expand Down
4 changes: 2 additions & 2 deletions data_model/src/events/data/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub enum WorldEvent {
Peer(PeerEvent),

#[cfg(feature = "roles")]
Role(Role),
Role(RoleEvent),
}

/// Event
Expand All @@ -203,7 +203,7 @@ pub enum Event {
Peer(PeerEvent),
/// Role event
#[cfg(feature = "roles")]
Role(Role),
Role(RoleEvent),
/// Account event
Account(AccountEvent),
/// Asset definition event
Expand Down
19 changes: 7 additions & 12 deletions data_model/src/events/data/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,15 @@ impl Filter for EntityFilter {

fn filter(&self, event: &Event) -> bool {
match (self, event) {
(&Self::ByDomain(ref filter_opt), &Event::Domain(ref domain)) => {
filter_opt.filter(domain)
}
(&Self::ByPeer(ref filter_opt), &Event::Peer(ref peer)) => filter_opt.filter(peer),
(Self::ByDomain(filter_opt), Event::Domain(domain)) => filter_opt.filter(domain),
(Self::ByPeer(filter_opt), Event::Peer(peer)) => filter_opt.filter(peer),
#[cfg(feature = "roles")]
(&Self::ByRole(ref filter_opt), &Event::Role(ref role)) => filter_opt.filter(role),
(&Self::ByAccount(ref filter_opt), &Event::Account(ref account)) => {
filter_opt.filter(account)
(Self::ByRole(filter_opt), Event::Role(role)) => filter_opt.filter(role),
(Self::ByAccount(filter_opt), Event::Account(account)) => filter_opt.filter(account),
(Self::ByAssetDefinition(filter_opt), Event::AssetDefinition(asset_definition)) => {
filter_opt.filter(asset_definition)
}
(
&Self::ByAssetDefinition(ref filter_opt),
&Event::AssetDefinition(ref asset_definition),
) => filter_opt.filter(asset_definition),
(&Self::ByAsset(ref filter_opt), &Event::Asset(ref asset)) => filter_opt.filter(asset),
(Self::ByAsset(filter_opt), Event::Asset(asset)) => filter_opt.filter(asset),
_ => false,
}
}
Expand Down
2 changes: 1 addition & 1 deletion data_model/src/events/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mod filters;
/// Exports common structs and enums from this module.
pub mod prelude {
#[cfg(feature = "roles")]
pub use super::RoleEvent;
pub use super::events::RoleEvent;
pub use super::{
events::{
AccountEvent, AssetDefinitionEvent, AssetEvent, DomainEvent, Event as DataEvent,
Expand Down

0 comments on commit fbea893

Please sign in to comment.