-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add ability to set_attr channel/group custom_fields #40
Conversation
There was a problem hiding this 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
lib/rocket_chat/messages/channel.rb
Outdated
@@ -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] |
There was a problem hiding this comment.
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
%i[custom_fields description join_code purpose read_only topic type] | |
%i[announcement custom_fields default description join_code purpose read_only topic type] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sure!
lib/rocket_chat/messages/group.rb
Outdated
@@ -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] |
There was a problem hiding this comment.
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
)
%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! 😄 )
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
6b78cbc
to
519484b
Compare
As I'm adding the rest of the |
@@ -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] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 😉
Released in v0.1.23 |
Aligning with create API and available endpoints