mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-26 02:21:06 -04:00
Improve colors buttons connect-actions.tsx
This commit is contained in:
@@ -58,7 +58,7 @@ import {deleteBookmarkedSearch} from './delete-bookmarked-search'
|
||||
import {deleteCompatibilityAnswer} from './delete-compatibility-answer'
|
||||
import {deleteMe} from './delete-me'
|
||||
import {getCompatibilityQuestions} from './get-compatibililty-questions'
|
||||
import {getConnectionInterests} from './get-connection-interests'
|
||||
import {getConnectionInterestsEndpoint} from './get-connection-interests'
|
||||
import {getCurrentPrivateUser} from './get-current-private-user'
|
||||
import {getEvents} from './get-events'
|
||||
import {getLikesAndShips} from './get-likes-and-ships'
|
||||
@@ -377,7 +377,7 @@ const handlers: {[k in APIPath]: APIHandler<k>} = {
|
||||
'update-user-locale': updateUserLocale,
|
||||
'update-private-user-message-channel': updatePrivateUserMessageChannel,
|
||||
'update-profile': updateProfile,
|
||||
'get-connection-interests': getConnectionInterests,
|
||||
'get-connection-interests': getConnectionInterestsEndpoint,
|
||||
'update-connection-interest': updateConnectionInterests,
|
||||
'user/by-id/:id': getUser,
|
||||
'user/by-id/:id/block': blockUser,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import {getConnectionInterests} from 'api/get-connection-interests'
|
||||
import {APIError, APIHandler} from 'api/helpers/endpoint'
|
||||
import {addUsersToPrivateMessageChannel} from 'api/helpers/private-messages'
|
||||
import {filterDefined} from 'common/util/array'
|
||||
import * as admin from 'firebase-admin'
|
||||
import {uniq} from 'lodash'
|
||||
import {getProfile} from 'shared/profiles/supabase'
|
||||
import {createSupabaseDirectClient} from 'shared/supabase/init'
|
||||
import {getPrivateUser, getUser} from 'shared/utils'
|
||||
|
||||
@@ -39,7 +41,21 @@ export const createPrivateUserMessageChannel: APIHandler<
|
||||
user.blockedUserIds.some((blockedId: string) => userIds.includes(blockedId)),
|
||||
)
|
||||
) {
|
||||
throw new APIError(403, 'One of the users has blocked another user in the list')
|
||||
throw new APIError(403, `One of the users has blocked another user in the list`)
|
||||
}
|
||||
|
||||
for (const u of toPrivateUsers) {
|
||||
const p = await getProfile(u.id)
|
||||
if (p && !p.allow_direct_messaging) {
|
||||
const {interests, targetInterests} = await getConnectionInterests(
|
||||
{targetUserId: u.id},
|
||||
auth.uid,
|
||||
)
|
||||
const matches = interests.filter((interest: string[]) => targetInterests.includes(interest))
|
||||
if (matches.length > 0) continue
|
||||
const failedUser = await getUser(u.id)
|
||||
throw new APIError(403, `${failedUser?.username} has disabled direct messaging`)
|
||||
}
|
||||
}
|
||||
|
||||
const currentChannel = await pg.oneOrNone(
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import {APIHandler} from 'api/helpers/endpoint'
|
||||
import {createSupabaseDirectClient} from 'shared/supabase/init'
|
||||
|
||||
export const getConnectionInterests: APIHandler<'get-connection-interests'> = async (
|
||||
export const getConnectionInterestsEndpoint: APIHandler<'get-connection-interests'> = async (
|
||||
props,
|
||||
auth,
|
||||
) => {
|
||||
return getConnectionInterests(props, auth.uid)
|
||||
}
|
||||
|
||||
export const getConnectionInterests = async (props: any, userId: string) => {
|
||||
const {targetUserId} = props
|
||||
const userId = auth.uid
|
||||
|
||||
if (!targetUserId) {
|
||||
throw new Error('Missing target user ID')
|
||||
|
||||
Reference in New Issue
Block a user