Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set_attr channel/group custom_fields #40

Merged
merged 3 commits into from
Nov 11, 2022

Conversation

reist
Copy link
Contributor

@reist reist commented Nov 6, 2022

Aligning with create API and available endpoints

Copy link
Owner

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR @reist !

I have a few suggestions if you could take a look

@@ -68,7 +68,7 @@ def online(room_id: nil, name: nil)
# * [String] topic A room's topic
# * [Strong] type c (channel) or p (private group)
def self.settable_attributes
%i[description join_code purpose read_only topic type]
%i[custom_fields description join_code purpose read_only topic type]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be nice to see the other "new" setter attributes included. ie

Suggested change
%i[custom_fields description join_code purpose read_only topic type]
%i[announcement custom_fields default description join_code purpose read_only topic type]

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And could you please also update the documentation in the comment above? likely:

* [String] announcement Announcement for the channel
* [Hash] custom_fields Custom fields for the channel
* [Boolean] default Sets whether the channel is a default channel or not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sure!

@@ -98,7 +98,7 @@ def online(room_id: nil, name: nil)
# * [String] topic A room's topic
# * [Strong] type c (channel) or p (private group)
def self.settable_attributes
%i[description purpose read_only topic type]
%i[custom_fields description purpose read_only topic type]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, although groups only have the custom_fields and announcement setters (no setDefault)

Suggested change
%i[custom_fields description purpose read_only topic type]
%i[announcement custom_fields description purpose read_only topic type]

(and a similar comment change too! 😄 )

reist and others added 3 commits November 9, 2022 18:51
Aligning with create API and available endpoints
The extraData param allows setting arbitrary attributes on the RC Room.
Added to the API in RC v3.12.0 by Rocket.Chat PR 20617, commit 2ad2d0bd7ed
@reist reist force-pushed the add-custom-fields-to-rooms-api branch from 6b78cbc to 519484b Compare November 9, 2022 20:21
@reist
Copy link
Contributor Author

reist commented Nov 9, 2022

As I'm adding the rest of the set_attr options, I also added the "new" extraData option for create that we found we needed.

@@ -309,7 +309,7 @@ def members(room_id: nil, name: nil, offset: nil, count: nil, sort: nil)
attr_reader :session

def room_option_hash(options)
args = [options, :members, :read_only, :custom_fields]
args = [options, :members, :read_only, :custom_fields, :extra_data]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, but could you update the documentation too? See docs/channels.md#L17

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, don't worry.. I'll update it when I bump the release 😉

@abrom abrom merged commit f818507 into abrom:main Nov 11, 2022
@abrom
Copy link
Owner

abrom commented Nov 11, 2022

Released in v0.1.23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants