Add channel model property for shared channels (#5749)

This commit is contained in:
Elias Nahum
2021-10-13 14:28:09 -03:00
committed by GitHub
parent fcc6394502
commit ecd80fcd4f
8 changed files with 13 additions and 3 deletions

View File

@@ -91,6 +91,9 @@ export default class ChannelModel extends Model {
/** name : The name of the channel (e.g town-square) */
@field('name') name!: string;
/** shared: determines if it is a shared channel with another organization */
@field('shared') shared!: boolean;
/** team_id : The team to which this channel belongs. It can be empty for direct/group message. */
@field('team_id') teamId!: string;

View File

@@ -39,7 +39,7 @@ describe('*** CHANNEL Prepare Records Test ***', () => {
creator_id: '',
scheme_id: null,
group_constrained: null,
shared: null,
shared: false,
},
},
});

View File

@@ -39,6 +39,7 @@ export const transformChannelRecord = ({action, database, value}: TransformerArg
channel.displayName = raw.display_name;
channel.isGroupConstrained = Boolean(raw.group_constrained);
channel.name = raw.name;
channel.shared = Boolean(raw.shared);
channel.teamId = raw.team_id;
channel.type = raw.type;
};

View File

@@ -16,6 +16,7 @@ export default tableSchema({
{name: 'display_name', type: 'string'},
{name: 'is_group_constrained', type: 'boolean'},
{name: 'name', type: 'string', isIndexed: true},
{name: 'shared', type: 'boolean'},
{name: 'team_id', type: 'string', isIndexed: true},
{name: 'type', type: 'string'},
{name: 'update_at', type: 'number'},

View File

@@ -71,6 +71,7 @@ describe('*** Test schema for SERVER database ***', () => {
type: 'boolean',
},
name: {name: 'name', type: 'string', isIndexed: true},
shared: {name: 'shared', type: 'boolean'},
team_id: {name: 'team_id', type: 'string', isIndexed: true},
type: {name: 'type', type: 'string'},
update_at: {name: 'update_at', type: 'number'},
@@ -83,6 +84,7 @@ describe('*** Test schema for SERVER database ***', () => {
{name: 'display_name', type: 'string'},
{name: 'is_group_constrained', type: 'boolean'},
{name: 'name', type: 'string', isIndexed: true},
{name: 'shared', type: 'boolean'},
{name: 'team_id', type: 'string', isIndexed: true},
{name: 'type', type: 'string'},
{name: 'update_at', type: 'number'},

View File

@@ -56,7 +56,7 @@ const ChannelTitle = ({
const channelType = channel.type;
const isArchived = channel.deleteAt !== 0;
const isChannelMuted = channelSettings.notifyProps?.mark_unread === 'mention';
const isChannelShared = false; // todo: Read this value from ChannelModel when implemented
const isChannelShared = channel.shared;
const hasGuests = channelInfo.guestCount > 0;
const teammateRoles = teammate?.roles ?? '';
const isGuest = channelType === General.DM_CHANNEL && isTeammateGuest(teammateRoles);

View File

@@ -34,7 +34,7 @@ type Channel = {
status?: string;
fake?: boolean;
group_constrained: boolean|null;
shared: boolean|null;
shared: boolean;
};
type ChannelWithTeamData = Channel & {
team_display_name: string;

View File

@@ -35,6 +35,9 @@ export default class ChannelModel extends Model {
/** name : The name of the channel (e.g town-square) */
name: string;
/** shared: determines if it is a shared channel with another organization */
shared: boolean;
/** team_id : The team to which this channel belongs. It can be empty for direct/group message. */
teamId: string;