Meta attribute

This commit is contained in:
Jan Cernik 2023-02-13 22:36:29 -03:00
parent 0ccedf7009
commit a96862a8dd
No known key found for this signature in database
3 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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) {

View File

@ -26,6 +26,9 @@
"avatar_template": { "type": "string" },
"username": { "type": "string" }
}
},
"meta": {
"can_join_chat_channel": { "type": "boolean" }
}
}
}