Skip to content

Commit 4eb6309

Browse files
authored
Merge pull request #23 from Acode-Foundation/feat-supported_editor
style: update styles for publishPlugin and updatePluginEditor forms; …
2 parents 4d5a19f + 0c1a365 commit 4eb6309

5 files changed

Lines changed: 23 additions & 42 deletions

File tree

client/pages/publishPlugin/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@
6565
strong {
6666
display: inline-flex;
6767
align-items: center;
68+
line-height: 1;
6869
margin: 0 6px;
69-
padding: 4px 12px;
70+
padding: 0px 6px;
7071
background: rgba(255, 255, 255, 0.2);
7172
border-radius: 6px;
7273
font-weight: 600;
@@ -203,7 +204,6 @@
203204
}
204205

205206
a {
206-
width: 100%;
207207
justify-content: center;
208208
padding: 14px 20px;
209209
}

client/pages/updatePluginEditor/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,20 @@ export default async function UpdatePluginEditor({ id }) {
143143
<span className='error'>{errorText}</span>
144144
<span className='success'>{successText}</span>
145145

146+
<div
147+
style={{
148+
display: 'flex',
149+
alignItems: 'center',
150+
marginBottom: '16px',
151+
gap: '8px',
152+
}}
153+
>
154+
<input type='checkbox' name='agree_tested' id='tested_agreement' required={true} />
155+
<label htmlFor='tested_agreement' className='agreement'>
156+
I have tested my plugin with the selected editor(s) and confirm that it works correctly.
157+
</label>
158+
</div>
159+
146160
<button ref={submitButton} type='submit'>
147161
<span className='icon save' />
148162
{buttonText}

client/pages/updatePluginEditor/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@
129129
form {
130130
background: var(--box-background-color);
131131
border-radius: 8px;
132-
padding: 28px;
133-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
132+
padding: 0 !important;
133+
box-shadow: unset !important;
134134

135135
.editor-options {
136136
margin-bottom: 24px;

server/apis/plugin.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ router.get('{/:pluginId}', async (req, res) => {
274274

275275
if (supported_editor && ['ace', 'cm', 'all'].includes(supported_editor)) {
276276
where.push([Plugin.SUPPORTED_EDITOR, supported_editor]);
277+
278+
if (supported_editor !== 'all') {
279+
where.push('OR', [Plugin.SUPPORTED_EDITOR, 'all']);
280+
}
277281
} else if (!supported_editor && !allowAllEditors) {
278282
where.push([Plugin.SUPPORTED_EDITOR, 'all'], 'OR', [Plugin.SUPPORTED_EDITOR, 'ace']);
279283
}

server/updateSchema.js

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
const db = require('./lib/db');
2-
const sendEmail = require('./lib/sendEmail');
32

4-
const queries = ['ALTER TABLE plugin ADD COLUMN supported_editor TEXT DEFAULT "ace"'];
3+
const queries = [];
54

65
(async () => {
76
for (const query of queries) {
87
await new Promise((resolve, reject) => {
98
try {
109
db.exec(query);
11-
// TODO: Remove in next schema update.
12-
// safe to send email when successfully added the column, if it already exists, it means the email has already been sent in a previous run.
13-
sendUpdateEmail();
1410
resolve();
1511
} catch (err) {
1612
if (err.message.includes('duplicate column name')) {
@@ -24,36 +20,3 @@ const queries = ['ALTER TABLE plugin ADD COLUMN supported_editor TEXT DEFAULT "a
2420
});
2521
}
2622
})();
27-
28-
async function sendUpdateEmail() {
29-
const usersWithPlugins = query('SELECT DISTINCT user_id FROM plugin');
30-
const userIds = usersWithPlugins.map((row) => row.user_id);
31-
if (userIds.length === 0) {
32-
return;
33-
}
34-
35-
for (const userId of userIds) {
36-
const user = query('SELECT email, name FROM "user" WHERE id = ?', [userId]);
37-
if (!user || user.length === 0) continue;
38-
const [{ email, name }] = user;
39-
const emailBody = `We have recently updated our plugin system to support CodeMirror editor. Following plugins are pending update to specify supported editor:
40-
<ul>
41-
${activePlugins
42-
.map(
43-
(plugin) => `<li>
44-
<a href="https://acode.app/update-plugin-editor/${plugin.id}">${plugin.name}</a>
45-
</li>`,
46-
)
47-
.join('')}
48-
</ul>
49-
Please update your plugins to specify supported editor to avoid any disruption in service. If you have any questions, feel free to reach out to us.`;
50-
51-
await sendEmail(user.email, user.name, 'Action required: Update your plugins for new editor support', emailBody);
52-
}
53-
}
54-
55-
function query(sql, values = []) {
56-
const statement = db.prepare(sql);
57-
const result = statement.all(...values);
58-
return result;
59-
}

0 commit comments

Comments
 (0)