feat: 更新贡献昵称逻辑,允许用户留空昵称并调整相关测试用例
This commit is contained in:
+1
-1
@@ -6619,7 +6619,7 @@ async function refreshOAuthUrlBeforeStep6(state) {
|
|||||||
if (state?.contributionMode && contributionOAuthManager?.startContributionFlow) {
|
if (state?.contributionMode && contributionOAuthManager?.startContributionFlow) {
|
||||||
await addLog('步骤 7:contributionMode=true,走公开贡献接口,正在申请 OAuth 登录地址...', 'info');
|
await addLog('步骤 7:contributionMode=true,走公开贡献接口,正在申请 OAuth 登录地址...', 'info');
|
||||||
const contributionState = await contributionOAuthManager.startContributionFlow({
|
const contributionState = await contributionOAuthManager.startContributionFlow({
|
||||||
nickname: state.email,
|
nickname: state.contributionNickname || '',
|
||||||
openAuthTab: false,
|
openAuthTab: false,
|
||||||
stateOverride: state,
|
stateOverride: state,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -247,9 +247,8 @@
|
|||||||
|
|
||||||
function buildNickname(state = {}, preferredNickname = '') {
|
function buildNickname(state = {}, preferredNickname = '') {
|
||||||
const nickname = normalizeString(preferredNickname)
|
const nickname = normalizeString(preferredNickname)
|
||||||
|| normalizeString(state.email)
|
|
||||||
|| normalizeString(state.contributionNickname);
|
|| normalizeString(state.contributionNickname);
|
||||||
return nickname || 'codex-extension-user';
|
return nickname || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildContributionQq(state = {}, preferredQq = '') {
|
function buildContributionQq(state = {}, preferredQq = '') {
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
<p id="contribution-mode-text" class="contribution-mode-text">当前账号将用于支持项目维护。扩展会自动申请贡献登录地址并持续跟踪授权状态;如检测到回调地址,会自动提交,无需手动复制。</p>
|
<p id="contribution-mode-text" class="contribution-mode-text">当前账号将用于支持项目维护。扩展会自动申请贡献登录地址并持续跟踪授权状态;如检测到回调地址,会自动提交,无需手动复制。</p>
|
||||||
<div class="data-row contribution-mode-field">
|
<div class="data-row contribution-mode-field">
|
||||||
<span class="data-label">贡献昵称</span>
|
<span class="data-label">贡献昵称</span>
|
||||||
<input type="text" id="input-contribution-nickname" class="data-input" placeholder="可留空,默认使用当前邮箱" />
|
<input type="text" id="input-contribution-nickname" class="data-input" placeholder="可留空,将显示为匿名贡献者" />
|
||||||
</div>
|
</div>
|
||||||
<div class="data-row contribution-mode-field">
|
<div class="data-row contribution-mode-field">
|
||||||
<span class="data-label">QQ</span>
|
<span class="data-label">QQ</span>
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ test('contribution oauth manager starts session, opens auth url, submits callbac
|
|||||||
assert.equal(startedState.contributionAuthTabId, 88);
|
assert.equal(startedState.contributionAuthTabId, 88);
|
||||||
assert.equal(tabCalls.length, 1);
|
assert.equal(tabCalls.length, 1);
|
||||||
assert.match(fetchCalls[0].url, /\/start$/);
|
assert.match(fetchCalls[0].url, /\/start$/);
|
||||||
assert.match(String(fetchCalls[0].options.body || ''), /"nickname":"user@example\.com"/);
|
assert.match(String(fetchCalls[0].options.body || ''), /"nickname":""/);
|
||||||
assert.match(String(fetchCalls[0].options.body || ''), /"qq":""/);
|
assert.match(String(fetchCalls[0].options.body || ''), /"qq":""/);
|
||||||
assert.match(fetchCalls[1].url, /\/status\?/);
|
assert.match(fetchCalls[1].url, /\/status\?/);
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ return { refreshOAuthUrlBeforeStep6 };
|
|||||||
{
|
{
|
||||||
type: 'contribution',
|
type: 'contribution',
|
||||||
options: {
|
options: {
|
||||||
nickname: 'user@example.com',
|
nickname: '',
|
||||||
openAuthTab: false,
|
openAuthTab: false,
|
||||||
stateOverride: {
|
stateOverride: {
|
||||||
contributionMode: true,
|
contributionMode: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user