feat(links): move friend links to native WordPress links with review flow
- enable the native Links manager and drop the custom friend-link option/REST path - add per-page link settings for the friends template - render link categories from get_bookmarks() with search and page-content options - add a validated public link submission endpoint with logo upload, captcha, rate limiting and duplicate checks - create pending links for review and notify administrators by email and in-app message - add native Links admin pending count, columns and edit notes - cover the new submission and cleanup contracts Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ef7b5939ba
commit
4c562428b4
24 files changed
+792
-273
No files matched your search
@@ -53,11 +53,11 @@ test('the user center and public user home keep their legacy rounded-square avat
|
||||
assert.doesNotMatch(userHome, /\.jio-author-hero__avatar img\s*\{[^}]*--radius-avatar/s);
|
||||
});
|
||||
|
||||
test('every other frontend avatar frame is circular', () => {
|
||||
const friends = read('assets/css/routes/friends.css');
|
||||
test('link page cards keep their circular logo frames', () => {
|
||||
const links = read('assets/css/routes/links.css');
|
||||
|
||||
assert.match(friends, /\.friend-card__avatar\s*\{[^}]*border-radius:\s*var\(--radius-avatar,\s*50%\)/s);
|
||||
assert.doesNotMatch(friends, /\.friend-card__avatar\s*\{[^}]*border-radius:\s*var\(--radius\)/s);
|
||||
assert.match(links, /\.links-card\.big-card \.link-img img\s*\{[^}]*border-radius:\s*100px/s);
|
||||
assert.match(links, /\.link-img\s*\{[^}]*width:\s*var\(--this-size\)/s);
|
||||
});
|
||||
|
||||
test('the user card name row can shrink once the VIP icon joins the badge row', () => {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
const test = require('node:test')
|
||||
const assert = require('node:assert/strict')
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
|
||||
const root = path.resolve(__dirname, '..', '..')
|
||||
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8')
|
||||
|
||||
test('native links are the only friend-link store', () => {
|
||||
const setup = read('src/Core/Setup.php')
|
||||
const submissions = read('src/Core/LinksSubmission.php')
|
||||
const template = read('templates/pages/page-friends.php')
|
||||
const helper = read('inc/helpers/jio-links.php')
|
||||
|
||||
assert.match(setup, /pre_option_link_manager_enabled/)
|
||||
assert.match(submissions, /ACTION = 'jio_frontend_links_submit'/)
|
||||
assert.match(submissions, /add_action\('wp_ajax_' \. self::ACTION/)
|
||||
assert.match(submissions, /add_action\('wp_ajax_nopriv_' \. self::ACTION/)
|
||||
assert.match(submissions, /wp_insert_link\(/)
|
||||
assert.match(submissions, /jio_require_captcha\('friend_link'/)
|
||||
assert.match(submissions, /jio_captcha_rate_limited\('friend-link-submit'/)
|
||||
assert.match(template, /jio_page_links_html\(/)
|
||||
assert.match(template, /jio_submit_links_modal\(/)
|
||||
assert.match(helper, /get_bookmarks\(/)
|
||||
})
|
||||
|
||||
test('the retired friend-link option and admin REST surface stay gone', () => {
|
||||
for (const file of [
|
||||
'src/Settings/DisplayRuntime.php',
|
||||
'assets/css/routes/friends.css',
|
||||
]) {
|
||||
assert.equal(fs.existsSync(path.join(root, file)), false, file)
|
||||
}
|
||||
for (const file of [
|
||||
'src/Admin/GlobalController.php',
|
||||
'src/Settings/Settings.php',
|
||||
'src/Settings/DisplayPageGroups.php',
|
||||
'inc/helpers/template-tags/media-brand.php',
|
||||
'assets/admin/src/api/modules/global.js',
|
||||
]) {
|
||||
const source = read(file)
|
||||
assert.doesNotMatch(source, /jio_friend_links|friend-links|get_friend_links|save_friend_links/, file)
|
||||
}
|
||||
})
|
||||
|
||||
test('page options and submission wiring point at the links template', () => {
|
||||
const metaBox = read('src/Admin/PageLinksMetaBox.php')
|
||||
const scripts = read('src/Core/ScriptsPart1b.php')
|
||||
const captcha = read('inc/modules/captcha.php')
|
||||
const notifications = read('src/Settings/MailNotifications.php')
|
||||
const templates = read('src/Settings/MailTemplates.php')
|
||||
|
||||
assert.match(metaBox, /templates\/pages\/page-friends\.php/)
|
||||
assert.match(metaBox, /wp_verify_nonce/)
|
||||
assert.match(metaBox, /current_user_can\('edit_page'/)
|
||||
assert.match(metaBox, /page_links_submit_s/)
|
||||
assert.match(scripts, /links-submit\.js/)
|
||||
assert.match(captcha, /'friend_link'\s*=>/)
|
||||
assert.match(notifications, /links_submit_admin/)
|
||||
assert.match(notifications, /Message::get_instance\(\)->send/)
|
||||
assert.match(templates, /review_url/)
|
||||
})
|
||||
Reference in new issue
Block a user