Meta attribute
This commit is contained in:
parent
0ccedf7009
commit
a96862a8dd
@ -9,10 +9,9 @@ class BaseChatChannelMembershipSerializer < ApplicationSerializer
|
||||
:last_read_message_id,
|
||||
:unread_count,
|
||||
:unread_mentions,
|
||||
:can_join_chat_channel
|
||||
:meta
|
||||
|
||||
def can_join_chat_channel
|
||||
chat_channel = ChatChannel.find_by(id: object[:chat_channel_id])
|
||||
scope.can_join_chat_channel?(chat_channel) if chat_channel
|
||||
def meta
|
||||
{ can_join_chat_channel: scope.can_join_chat_channel?(object.chat_channel) }
|
||||
end
|
||||
end
|
||||
|
||||
@ -120,7 +120,7 @@ export default class ChatChannel extends RestModel {
|
||||
}
|
||||
|
||||
get canJoin() {
|
||||
return this.currentUserMembership.can_join_chat_channel;
|
||||
return this.currentUserMembership.meta?.can_join_chat_channel;
|
||||
}
|
||||
|
||||
canModifyMessages(user) {
|
||||
|
||||
@ -26,6 +26,9 @@
|
||||
"avatar_template": { "type": "string" },
|
||||
"username": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"can_join_chat_channel": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user