forked from Ivasoft/mattermost-mobile
Add channel model property for shared channels (#5749)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('*** CHANNEL Prepare Records Test ***', () => {
|
||||
creator_id: '',
|
||||
scheme_id: null,
|
||||
group_constrained: null,
|
||||
shared: null,
|
||||
shared: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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'},
|
||||
|
||||
@@ -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'},
|
||||
|
||||
@@ -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);
|
||||
|
||||
2
types/api/channels.d.ts
vendored
2
types/api/channels.d.ts
vendored
@@ -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;
|
||||
|
||||
3
types/database/models/servers/channel.d.ts
vendored
3
types/database/models/servers/channel.d.ts
vendored
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user