mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-09-01 12:26:08 +08:00
fix: locale permissions
This commit is contained in:
parent
7cfaa0fe16
commit
d1e9df8f70
3 changed files with 6 additions and 9 deletions
|
@ -76,11 +76,6 @@ export const getCampaign = async (id: number, projectId: number): Promise<Campai
|
|||
if (campaign.state === 'loading') {
|
||||
campaign.progress = await campaignPopulationProgress(campaign)
|
||||
}
|
||||
|
||||
logger.warn({
|
||||
query: await recipientClickhouseQuery(campaign),
|
||||
campaignId: campaign.id,
|
||||
}, 'campaign:generate:query')
|
||||
}
|
||||
|
||||
return campaign
|
||||
|
|
|
@ -13,7 +13,7 @@ const router = new Router<
|
|||
prefix: '/locales',
|
||||
})
|
||||
|
||||
router.use(projectRoleMiddleware('admin'))
|
||||
router.use(projectRoleMiddleware('editor'))
|
||||
|
||||
router.get('/', async ctx => {
|
||||
const params = extractQueryParams(ctx.query, searchParamsSchema)
|
||||
|
|
|
@ -5,10 +5,11 @@ import { LocaleParams, createLocale, localeOption } from './CampaignDetail'
|
|||
import RadioInput from '../../ui/form/RadioInput'
|
||||
import { useContext, useEffect, useState } from 'react'
|
||||
import api from '../../api'
|
||||
import { ProjectContext } from '../../contexts'
|
||||
import { AdminContext, ProjectContext } from '../../contexts'
|
||||
import { SingleSelect } from '../../ui/form/SingleSelect'
|
||||
import { LinkButton } from '../../ui'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { checkOrganizationRole } from '../../utils'
|
||||
|
||||
interface CreateTemplateParams {
|
||||
open: boolean
|
||||
|
@ -21,6 +22,7 @@ export default function CreateTemplateModal({ open, setIsOpen, campaign, onCreat
|
|||
|
||||
const { t } = useTranslation()
|
||||
const [project] = useContext(ProjectContext)
|
||||
const admin = useContext(AdminContext)
|
||||
const [locales, setLocales] = useState<LocaleOption[]>([])
|
||||
useEffect(() => {
|
||||
api.locales.search(project.id, { limit: 100 })
|
||||
|
@ -53,12 +55,12 @@ export default function CreateTemplateModal({ open, setIsOpen, campaign, onCreat
|
|||
options={locales}
|
||||
toValue={option => option.key}
|
||||
required />
|
||||
<div className="label">
|
||||
{checkOrganizationRole('admin', admin?.role) && <div className="label">
|
||||
<LinkButton
|
||||
size="small"
|
||||
variant="secondary"
|
||||
to={`/projects/${project.id}/settings/locales`}>{t('create_locale')}</LinkButton>
|
||||
</div>
|
||||
</div>}
|
||||
{ campaign.channel === 'email' && (
|
||||
<RadioInput.Field
|
||||
form={form}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue