Fix fetching unreads from archived channels, fetching groups on unlicensed servers and logs (#7406)

This commit is contained in:
Daniel Espino García
2023-06-20 19:52:05 +02:00
committed by GitHub
parent 01c9e1ab01
commit cffe80b442
3 changed files with 8 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ export const fetchGroupsForAutocomplete = async (serverUrl: string, query: strin
try {
const {operator, database} = DatabaseManager.getServerDatabaseAndOperator(serverUrl);
const license = await getLicense(database);
if (!license || !license.IsLicensed) {
if (!license || license.IsLicensed !== 'true') {
return [];
}
@@ -40,7 +40,7 @@ export const fetchGroupsByNames = async (serverUrl: string, names: string[], fet
try {
const {operator, database} = DatabaseManager.getServerDatabaseAndOperator(serverUrl);
const license = await getLicense(database);
if (!license || !license.IsLicensed) {
if (!license || license.IsLicensed !== 'true') {
return [];
}
@@ -70,7 +70,7 @@ export const fetchGroupsForChannel = async (serverUrl: string, channelId: string
try {
const {operator, database} = DatabaseManager.getServerDatabaseAndOperator(serverUrl);
const license = await getLicense(database);
if (!license || !license.IsLicensed) {
if (!license || license.IsLicensed !== 'true') {
return {groups: [], groupChannels: []};
}
@@ -102,7 +102,7 @@ export const fetchGroupsForTeam = async (serverUrl: string, teamId: string, fetc
try {
const {operator, database} = DatabaseManager.getServerDatabaseAndOperator(serverUrl);
const license = await getLicense(database);
if (!license || !license.IsLicensed) {
if (!license || license.IsLicensed !== 'true') {
return {groups: [], groupTeams: []};
}
@@ -133,7 +133,7 @@ export const fetchGroupsForMember = async (serverUrl: string, userId: string, fe
try {
const {operator, database} = DatabaseManager.getServerDatabaseAndOperator(serverUrl);
const license = await getLicense(database);
if (!license || !license.IsLicensed) {
if (!license || license.IsLicensed !== 'true') {
return {groups: [], groupMemberships: []};
}

View File

@@ -339,7 +339,7 @@ export const fetchPostsForUnreadChannels = async (serverUrl: string, channels: C
const promises = [];
for (const member of memberships) {
const channel = channels.find((c) => c.id === member.channel_id);
if (channel && (channel.total_msg_count - member.msg_count) > 0 && channel.id !== excludeChannelId) {
if (channel && !channel.delete_at && (channel.total_msg_count - member.msg_count) > 0 && channel.id !== excludeChannelId) {
promises.push(fetchPostsForChannel(serverUrl, channel.id));
}
}

View File

@@ -28,7 +28,8 @@ export function isErrorWithDetails(obj: unknown): obj is {details: Error} {
return (
typeof obj === 'object' &&
obj !== null &&
'details' in obj
'details' in obj &&
typeof obj.details !== 'undefined'
);
}