mirror of https://gitee.com/answerdev/answer.git
fix: support gravatar mirror sites
This commit is contained in:
parent
2076dcd0e5
commit
5b98eff4bc
|
@ -828,7 +828,7 @@ ui:
|
||||||
avatar:
|
avatar:
|
||||||
label: Profile Image
|
label: Profile Image
|
||||||
gravatar: Gravatar
|
gravatar: Gravatar
|
||||||
gravatar_text: You can change image on <1>gravatar.com</1>
|
gravatar_text: You can change image on
|
||||||
custom: Custom
|
custom: Custom
|
||||||
btn_refresh: Refresh
|
btn_refresh: Refresh
|
||||||
custom_text: You can upload your image.
|
custom_text: You can upload your image.
|
||||||
|
@ -1556,6 +1556,9 @@ ui:
|
||||||
avatar:
|
avatar:
|
||||||
label: Default Avatar
|
label: Default Avatar
|
||||||
text: For users without a custom avatar of their own.
|
text: For users without a custom avatar of their own.
|
||||||
|
gravatar_base_url:
|
||||||
|
label: Gravatar Base URL
|
||||||
|
text: URL of the Gravatar provider’s API base. Ignored when empty.
|
||||||
profile_editable:
|
profile_editable:
|
||||||
title: Profile Editable
|
title: Profile Editable
|
||||||
allow_update_display_name:
|
allow_update_display_name:
|
||||||
|
|
|
@ -333,6 +333,7 @@ export interface AdminSettingsUsers {
|
||||||
allow_update_username: boolean;
|
allow_update_username: boolean;
|
||||||
allow_update_website: boolean;
|
allow_update_website: boolean;
|
||||||
default_avatar: string;
|
default_avatar: string;
|
||||||
|
gravatar_base_url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SiteSettings {
|
export interface SiteSettings {
|
||||||
|
@ -568,8 +569,3 @@ export interface UserOauthConnectorItem extends OauthConnectorItem {
|
||||||
binding: boolean;
|
binding: boolean;
|
||||||
external_id: string;
|
external_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QuestionOperationReq {
|
|
||||||
id: string;
|
|
||||||
operation: 'pin' | 'unpin' | 'hide' | 'show';
|
|
||||||
}
|
|
||||||
|
|
|
@ -31,6 +31,11 @@ const Index: FC = () => {
|
||||||
enumNames: SYSTEM_AVATAR_OPTIONS?.map((v) => v.label),
|
enumNames: SYSTEM_AVATAR_OPTIONS?.map((v) => v.label),
|
||||||
default: 'system',
|
default: 'system',
|
||||||
},
|
},
|
||||||
|
gravatar_base_url: {
|
||||||
|
type: 'string',
|
||||||
|
title: t('gravatar_base_url.label'),
|
||||||
|
description: t('gravatar_base_url.text'),
|
||||||
|
},
|
||||||
profile_editable: {
|
profile_editable: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
title: t('profile_editable.title'),
|
title: t('profile_editable.title'),
|
||||||
|
@ -68,6 +73,9 @@ const Index: FC = () => {
|
||||||
default_avatar: {
|
default_avatar: {
|
||||||
'ui:widget': 'select',
|
'ui:widget': 'select',
|
||||||
},
|
},
|
||||||
|
gravatar_base_url: {
|
||||||
|
'ui:widget': 'input',
|
||||||
|
},
|
||||||
profile_editable: {
|
profile_editable: {
|
||||||
'ui:widget': 'legend',
|
'ui:widget': 'legend',
|
||||||
},
|
},
|
||||||
|
@ -127,6 +135,7 @@ const Index: FC = () => {
|
||||||
allow_update_username: formData.allow_update_username.value,
|
allow_update_username: formData.allow_update_username.value,
|
||||||
allow_update_website: formData.allow_update_website.value,
|
allow_update_website: formData.allow_update_website.value,
|
||||||
default_avatar: formData.default_avatar.value,
|
default_avatar: formData.default_avatar.value,
|
||||||
|
gravatar_base_url: formData.gravatar_base_url.value,
|
||||||
};
|
};
|
||||||
putUsersSetting(reqParams)
|
putUsersSetting(reqParams)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -155,6 +164,9 @@ const Index: FC = () => {
|
||||||
if (k === 'default_avatar' && !v) {
|
if (k === 'default_avatar' && !v) {
|
||||||
v = 'system';
|
v = 'system';
|
||||||
}
|
}
|
||||||
|
if (k === 'gravatar_base_url' && !v) {
|
||||||
|
v = 'https://www.gravatar.com/avatar/';
|
||||||
|
}
|
||||||
formMeta[k] = { ...formData[k], value: v };
|
formMeta[k] = { ...formData[k], value: v };
|
||||||
});
|
});
|
||||||
setFormData({ ...formData, ...formMeta });
|
setFormData({ ...formData, ...formMeta });
|
||||||
|
|
|
@ -81,6 +81,7 @@ const Index = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
|
console.log('clear data');
|
||||||
setFormData({
|
setFormData({
|
||||||
displayName: {
|
displayName: {
|
||||||
value: '',
|
value: '',
|
||||||
|
|
|
@ -355,15 +355,20 @@ const Index: React.FC = () => {
|
||||||
className="me-3 rounded"
|
className="me-3 rounded"
|
||||||
/>
|
/>
|
||||||
<Form.Text className="text-muted mt-1">
|
<Form.Text className="text-muted mt-1">
|
||||||
<Trans i18nKey="settings.profile.avatar.gravatar_text">
|
<span>{t('avatar.gravatar_text')}</span>
|
||||||
You can change image on
|
<a
|
||||||
<a
|
href={
|
||||||
href="https://gravatar.com"
|
usersSetting.gravatar_base_url.includes('gravatar.cn')
|
||||||
target="_blank"
|
? 'https://gravatar.cn'
|
||||||
rel="noreferrer">
|
: 'https://gravatar.com'
|
||||||
gravatar.com
|
}
|
||||||
</a>
|
className="ms-1"
|
||||||
</Trans>
|
target="_blank"
|
||||||
|
rel="noreferrer">
|
||||||
|
{usersSetting.gravatar_base_url.includes('gravatar.cn')
|
||||||
|
? 'gravatar.cn'
|
||||||
|
: 'gravatar.com'}
|
||||||
|
</a>
|
||||||
</Form.Text>
|
</Form.Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -11,6 +11,7 @@ export interface AdminSettingsUsers {
|
||||||
allow_update_username: boolean;
|
allow_update_username: boolean;
|
||||||
allow_update_website: boolean;
|
allow_update_website: boolean;
|
||||||
default_avatar: string;
|
default_avatar: string;
|
||||||
|
gravatar_base_url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PrivilegeLevel {
|
interface PrivilegeLevel {
|
||||||
|
|
|
@ -21,6 +21,7 @@ const defaultUsersConf: AdminSettingsUsers = {
|
||||||
allow_update_username: false,
|
allow_update_username: false,
|
||||||
allow_update_website: false,
|
allow_update_website: false,
|
||||||
default_avatar: 'system',
|
default_avatar: 'system',
|
||||||
|
gravatar_base_url: 'https://www.gravatar.com/avatar/',
|
||||||
};
|
};
|
||||||
|
|
||||||
const siteInfo = create<SiteInfoType>((set) => ({
|
const siteInfo = create<SiteInfoType>((set) => ({
|
||||||
|
|
Loading…
Reference in New Issue