Skip to content

Commit

Permalink
remove pinned frames url from the code
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jan 23, 2025
1 parent 92d21f7 commit 65b26aa
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 264 deletions.
50 changes: 0 additions & 50 deletions bindings_ffi/src/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ pub struct FfiPermissionPolicySet {
pub update_group_name_policy: FfiPermissionPolicy,
pub update_group_description_policy: FfiPermissionPolicy,
pub update_group_image_url_square_policy: FfiPermissionPolicy,
pub update_group_pinned_frame_url_policy: FfiPermissionPolicy,
pub update_message_expiration_ms_policy: FfiPermissionPolicy,
}

Expand Down Expand Up @@ -817,10 +816,6 @@ impl TryFrom<FfiPermissionPolicySet> for PolicySet {
MetadataField::GroupImageUrlSquare.to_string(),
policy_set.update_group_image_url_square_policy.try_into()?,
);
metadata_permissions_map.insert(
MetadataField::GroupPinnedFrameUrl.to_string(),
policy_set.update_group_pinned_frame_url_policy.try_into()?,
);
// MessageExpirationFromMillis follows the same policy as MessageExpirationMillis
metadata_permissions_map.insert(
MetadataField::MessageExpirationFromMillis.to_string(),
Expand Down Expand Up @@ -850,7 +845,6 @@ pub enum FfiMetadataField {
GroupName,
Description,
ImageUrlSquare,
PinnedFrameUrl,
}

impl From<&FfiMetadataField> for MetadataField {
Expand All @@ -859,7 +853,6 @@ impl From<&FfiMetadataField> for MetadataField {
FfiMetadataField::GroupName => MetadataField::GroupName,
FfiMetadataField::Description => MetadataField::Description,
FfiMetadataField::ImageUrlSquare => MetadataField::GroupImageUrlSquare,
FfiMetadataField::PinnedFrameUrl => MetadataField::GroupPinnedFrameUrl,
}
}
}
Expand Down Expand Up @@ -1454,7 +1447,6 @@ pub struct FfiCreateGroupOptions {
pub group_name: Option<String>,
pub group_image_url_square: Option<String>,
pub group_description: Option<String>,
pub group_pinned_frame_url: Option<String>,
pub custom_permission_policy_set: Option<FfiPermissionPolicySet>,
pub message_expiration_from_ms: Option<i64>,
pub message_expiration_ms: Option<i64>,
Expand All @@ -1466,7 +1458,6 @@ impl FfiCreateGroupOptions {
name: self.group_name,
image_url_square: self.group_image_url_square,
description: self.group_description,
pinned_frame_url: self.group_pinned_frame_url,
message_expiration_from_ms: self.message_expiration_from_ms,
message_expiration_ms: self.message_expiration_ms,
}
Expand Down Expand Up @@ -1681,24 +1672,6 @@ impl FfiConversation {
Ok(self.inner.group_description(&provider)?)
}

pub async fn update_group_pinned_frame_url(
&self,
pinned_frame_url: String,
) -> Result<(), GenericError> {
self.inner
.update_group_pinned_frame_url(pinned_frame_url)
.await?;

Ok(())
}

pub fn group_pinned_frame_url(&self) -> Result<String, GenericError> {
let provider = self.inner.mls_provider()?;
self.inner
.group_pinned_frame_url(&provider)
.map_err(Into::into)
}

pub fn admin_list(&self) -> Result<Vec<String>, GenericError> {
let provider = self.inner.mls_provider()?;
self.inner.admin_list(&provider).map_err(Into::into)
Expand Down Expand Up @@ -2215,9 +2188,6 @@ impl FfiGroupPermissions {
update_group_image_url_square_policy: get_policy(
MetadataField::GroupImageUrlSquare.as_str(),
),
update_group_pinned_frame_url_policy: get_policy(
MetadataField::GroupPinnedFrameUrl.as_str(),
),
update_message_expiration_ms_policy: get_policy(
MetadataField::MessageExpirationMillis.as_str(),
),
Expand Down Expand Up @@ -2945,7 +2915,6 @@ mod tests {
group_name: Some("Group Name".to_string()),
group_image_url_square: Some("url".to_string()),
group_description: Some("group description".to_string()),
group_pinned_frame_url: Some("pinned frame".to_string()),
custom_permission_policy_set: None,
message_expiration_from_ms: None,
message_expiration_ms: None,
Expand All @@ -2959,7 +2928,6 @@ mod tests {
assert_eq!(group.group_name().unwrap(), "Group Name");
assert_eq!(group.group_image_url_square().unwrap(), "url");
assert_eq!(group.group_description().unwrap(), "group description");
assert_eq!(group.group_pinned_frame_url().unwrap(), "pinned frame");
}

// Looks like this test might be a separate issue
Expand Down Expand Up @@ -4458,7 +4426,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Admin,
update_group_description_policy: FfiPermissionPolicy::Admin,
update_group_image_url_square_policy: FfiPermissionPolicy::Admin,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Admin,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
};
assert_eq!(alix_permission_policy_set, expected_permission_policy_set);
Expand Down Expand Up @@ -4488,7 +4455,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Allow,
update_group_description_policy: FfiPermissionPolicy::Allow,
update_group_image_url_square_policy: FfiPermissionPolicy::Allow,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Allow,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
};
assert_eq!(alix_permission_policy_set, expected_permission_policy_set);
Expand Down Expand Up @@ -4519,7 +4485,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Allow,
update_group_description_policy: FfiPermissionPolicy::Allow,
update_group_image_url_square_policy: FfiPermissionPolicy::Allow,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Allow,
update_message_expiration_ms_policy: FfiPermissionPolicy::Allow,
};
assert_eq!(alix_permission_policy_set, expected_permission_policy_set);
Expand Down Expand Up @@ -4549,7 +4514,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Allow,
update_group_description_policy: FfiPermissionPolicy::Allow,
update_group_image_url_square_policy: FfiPermissionPolicy::Allow,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Allow,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
};
assert_eq!(alix_permission_policy_set, expected_permission_policy_set);
Expand Down Expand Up @@ -4583,7 +4547,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Admin,
update_group_description_policy: FfiPermissionPolicy::Admin,
update_group_image_url_square_policy: FfiPermissionPolicy::Admin,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Admin,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
};
assert_eq!(alix_group_permissions, expected_permission_policy_set);
Expand Down Expand Up @@ -4611,7 +4574,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Admin,
update_group_description_policy: FfiPermissionPolicy::Admin,
update_group_image_url_square_policy: FfiPermissionPolicy::Allow,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Admin,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
};
assert_eq!(alix_group_permissions, new_expected_permission_policy_set);
Expand Down Expand Up @@ -4663,7 +4625,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Admin,
update_group_description_policy: FfiPermissionPolicy::Allow,
update_group_image_url_square_policy: FfiPermissionPolicy::Admin,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Admin,
add_member_policy: FfiPermissionPolicy::Allow,
remove_member_policy: FfiPermissionPolicy::Deny,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
Expand All @@ -4674,7 +4635,6 @@ mod tests {
group_name: Some("Test Group".to_string()),
group_image_url_square: Some("https://example.com/image.png".to_string()),
group_description: Some("A test group".to_string()),
group_pinned_frame_url: Some("https://example.com/frame.png".to_string()),
custom_permission_policy_set: Some(custom_permissions),
message_expiration_from_ms: None,
message_expiration_ms: None,
Expand Down Expand Up @@ -4712,10 +4672,6 @@ mod tests {
group_permissions_policy_set.update_group_image_url_square_policy,
FfiPermissionPolicy::Admin
);
assert_eq!(
group_permissions_policy_set.update_group_pinned_frame_url_policy,
FfiPermissionPolicy::Admin
);
assert_eq!(
group_permissions_policy_set.update_message_expiration_ms_policy,
FfiPermissionPolicy::Admin
Expand Down Expand Up @@ -4780,7 +4736,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Admin,
update_group_description_policy: FfiPermissionPolicy::Allow,
update_group_image_url_square_policy: FfiPermissionPolicy::Admin,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Admin,
add_member_policy: FfiPermissionPolicy::Allow,
remove_member_policy: FfiPermissionPolicy::Deny,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
Expand All @@ -4792,7 +4747,6 @@ mod tests {
update_group_name_policy: FfiPermissionPolicy::Admin,
update_group_description_policy: FfiPermissionPolicy::Allow,
update_group_image_url_square_policy: FfiPermissionPolicy::Admin,
update_group_pinned_frame_url_policy: FfiPermissionPolicy::Admin,
add_member_policy: FfiPermissionPolicy::Allow,
remove_member_policy: FfiPermissionPolicy::Deny,
update_message_expiration_ms_policy: FfiPermissionPolicy::Admin,
Expand All @@ -4803,7 +4757,6 @@ mod tests {
group_name: Some("Test Group".to_string()),
group_image_url_square: Some("https://example.com/image.png".to_string()),
group_description: Some("A test group".to_string()),
group_pinned_frame_url: Some("https://example.com/frame.png".to_string()),
custom_permission_policy_set: Some(custom_permissions_invalid_1),
message_expiration_from_ms: None,
message_expiration_ms: None,
Expand All @@ -4824,7 +4777,6 @@ mod tests {
group_name: Some("Test Group".to_string()),
group_image_url_square: Some("https://example.com/image.png".to_string()),
group_description: Some("A test group".to_string()),
group_pinned_frame_url: Some("https://example.com/frame.png".to_string()),
custom_permission_policy_set: Some(custom_permissions_valid.clone()),
message_expiration_from_ms: None,
message_expiration_ms: None,
Expand All @@ -4845,7 +4797,6 @@ mod tests {
group_name: Some("Test Group".to_string()),
group_image_url_square: Some("https://example.com/image.png".to_string()),
group_description: Some("A test group".to_string()),
group_pinned_frame_url: Some("https://example.com/frame.png".to_string()),
custom_permission_policy_set: Some(custom_permissions_valid.clone()),
message_expiration_from_ms: None,
message_expiration_ms: None,
Expand All @@ -4866,7 +4817,6 @@ mod tests {
group_name: Some("Test Group".to_string()),
group_image_url_square: Some("https://example.com/image.png".to_string()),
group_description: Some("A test group".to_string()),
group_pinned_frame_url: Some("https://example.com/frame.png".to_string()),
custom_permission_policy_set: Some(custom_permissions_valid),
message_expiration_from_ms: None,
message_expiration_ms: None,
Expand Down
31 changes: 0 additions & 31 deletions bindings_node/src/conversation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,37 +522,6 @@ impl Conversation {
Ok(group_description)
}

#[napi]
pub async fn update_group_pinned_frame_url(&self, pinned_frame_url: String) -> Result<()> {
let group = MlsGroup::new(
self.inner_client.clone(),
self.group_id.clone(),
self.created_at_ns,
);

group
.update_group_pinned_frame_url(pinned_frame_url)
.await
.map_err(ErrorWrapper::from)?;

Ok(())
}

#[napi]
pub fn group_pinned_frame_url(&self) -> Result<String> {
let group = MlsGroup::new(
self.inner_client.clone(),
self.group_id.clone(),
self.created_at_ns,
);

let group_pinned_frame_url = group
.group_pinned_frame_url(&group.mls_provider().map_err(ErrorWrapper::from)?)
.map_err(ErrorWrapper::from)?;

Ok(group_pinned_frame_url)
}

#[napi(ts_args_type = "callback: (err: null | Error, result: Message | undefined) => void")]
pub fn stream(&self, callback: JsFunction) -> Result<StreamCloser> {
let tsfn: ThreadsafeFunction<Message, ErrorStrategy::CalleeHandled> =
Expand Down
3 changes: 0 additions & 3 deletions bindings_node/src/conversations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ pub struct CreateGroupOptions {
pub group_name: Option<String>,
pub group_image_url_square: Option<String>,
pub group_description: Option<String>,
pub group_pinned_frame_url: Option<String>,
pub custom_permission_policy_set: Option<PermissionPolicySet>,
pub message_expiration_from_ms: Option<i64>,
pub message_expiration_ms: Option<i64>,
Expand All @@ -132,7 +131,6 @@ impl CreateGroupOptions {
name: self.group_name,
image_url_square: self.group_image_url_square,
description: self.group_description,
pinned_frame_url: self.group_pinned_frame_url,
message_expiration_from_ms: self.message_expiration_from_ms,
message_expiration_ms: self.message_expiration_ms,
}
Expand Down Expand Up @@ -161,7 +159,6 @@ impl Conversations {
group_name: None,
group_image_url_square: None,
group_description: None,
group_pinned_frame_url: None,
custom_permission_policy_set: None,
message_expiration_from_ms: None,
message_expiration_ms: None,
Expand Down
10 changes: 0 additions & 10 deletions bindings_node/src/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ pub struct PermissionPolicySet {
pub update_group_name_policy: PermissionPolicy,
pub update_group_description_policy: PermissionPolicy,
pub update_group_image_url_square_policy: PermissionPolicy,
pub update_group_pinned_frame_url_policy: PermissionPolicy,
pub update_message_expiration_ms_policy: PermissionPolicy,
}

Expand Down Expand Up @@ -213,9 +212,6 @@ impl GroupPermissions {
update_group_image_url_square_policy: get_policy(
XmtpMetadataField::GroupImageUrlSquare.as_str(),
),
update_group_pinned_frame_url_policy: get_policy(
XmtpMetadataField::GroupPinnedFrameUrl.as_str(),
),
update_message_expiration_ms_policy: get_policy(
XmtpMetadataField::MessageExpirationMillis.as_str(),
),
Expand All @@ -241,10 +237,6 @@ impl TryFrom<PermissionPolicySet> for PolicySet {
XmtpMetadataField::GroupImageUrlSquare.to_string(),
policy_set.update_group_image_url_square_policy.try_into()?,
);
metadata_permissions_map.insert(
XmtpMetadataField::GroupPinnedFrameUrl.to_string(),
policy_set.update_group_pinned_frame_url_policy.try_into()?,
);
metadata_permissions_map.insert(
XmtpMetadataField::MessageExpirationMillis.to_string(),
policy_set.update_message_expiration_ms_policy.try_into()?,
Expand All @@ -266,7 +258,6 @@ pub enum MetadataField {
GroupName,
Description,
ImageUrlSquare,
PinnedFrameUrl,
}

impl From<&MetadataField> for XmtpMetadataField {
Expand All @@ -275,7 +266,6 @@ impl From<&MetadataField> for XmtpMetadataField {
MetadataField::GroupName => XmtpMetadataField::GroupName,
MetadataField::Description => XmtpMetadataField::Description,
MetadataField::ImageUrlSquare => XmtpMetadataField::GroupImageUrlSquare,
MetadataField::PinnedFrameUrl => XmtpMetadataField::GroupPinnedFrameUrl,
}
}
}
Loading

0 comments on commit 65b26aa

Please sign in to comment.