Skip to content

Commit a06c1e8

Browse files
committed
fix(ideas): align roadmap status enum with the documented 4-lane spec
The 1.4.2 readme advertised four roadmap status lanes (Planned, In Progress, Shipped, Declined) but the schema and admin UI shipped six (Submitted, Under Review, Planned, In Progress, Completed, Declined) with "Completed" rendered where docs said "Shipped". Customer reading readme.txt or the new docs/website/spaces-and-categories/06-ideas-roadmap.md page expected four lanes, the live UI rendered six. This commit brings the code in line with the documented contract. Schema + data - New migration 1.4.2.2 ALTERs idea_status ENUM to ('planned','in_progress', 'shipped','declined') DEFAULT NULL. - Two-step ENUM ALTER (transitional 7-value, then final 4-value) so existing 'completed' rows can be UPDATEd to 'shipped' before the deprecated values are removed. - Data remap: 'submitted' / 'under_review' rows -> NULL (ideas without a curated status live in the space's normal feed and only appear on the roadmap when an owner assigns one); 'completed' rows -> 'shipped'. - JETONOMY_DB_VERSION bumped 1.4.2.1 -> 1.4.2.2. Code - Post::valid_idea_statuses() returns the 4 documented values; docblock describes the new lane progression. - jetonomy_idea_status_label() lists 4 labels; falls back to '' for unknown values instead of inventing a 'submitted' default. - jetonomy_render_idea_status_pill() renders nothing for empty / unknown status (no fake "Submitted" pill on un-triaged ideas). - templates/views/space-roadmap.php renders 4 columns; ideas with NULL idea_status are skipped (not silently bucketed into a default lane). - templates/views/single-post.php drops the 'submitted' fallback for the status setter; an unset idea has no active button until the owner picks. - assets/css/jetonomy.css + jetonomy-rtl.css collapse the pill rules to the 4 supported variants. Setup wizard - Step 1 default-community-type now offers all four types (Forum, Q&A, Ideas, Show & Tell) instead of only Forum + Q&A. Backend handler already validated all four; this only closes the UI gap. - Sample-data hint corrected: 6 spaces across all four types, ~12 posts. Customer-facing readme - 1.4.2 entry's Ideas line now states the four lane names so the changelog matches what ships.
1 parent 73918fd commit a06c1e8

11 files changed

Lines changed: 135 additions & 55 deletions

File tree

assets/css/jetonomy-rtl.css

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -953,14 +953,12 @@
953953
.jt-accepted-callout-head { display: inline-flex; align-items: center; gap: 6px; color: var(--jt-success); font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.02em; text-transform: uppercase; margin-block-end: 8px; }
954954
.jt-accepted-callout-body .jt-reply { background: var(--jt-bg); border: 1px solid var(--jt-border); border-radius: var(--jt-radius-sm); padding: 12px; }
955955

956-
/* Idea roadmap status pill — six canonical statuses, color-coded so the
956+
/* Idea roadmap status pill - four canonical statuses, color-coded so the
957957
listing and post header speak the same visual language as the kanban. */
958958
.jt-idea-pill { --jt-ip: var(--jt-text-secondary); display: inline-flex; align-items: center; background: color-mix(in srgb, var(--jt-ip) 14%, transparent); color: var(--jt-ip); font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: var(--jt-radius-full); letter-spacing: 0.02em; white-space: nowrap; }
959-
.jt-idea-pill-submitted { --jt-ip: var(--jt-accent); }
960-
.jt-idea-pill-under_review { --jt-ip: var(--jt-text-secondary); }
961-
.jt-idea-pill-planned { --jt-ip: var(--jt-warn); }
959+
.jt-idea-pill-planned { --jt-ip: var(--jt-accent); }
962960
.jt-idea-pill-in_progress { --jt-ip: var(--jt-warn); }
963-
.jt-idea-pill-completed { --jt-ip: var(--jt-success); }
961+
.jt-idea-pill-shipped { --jt-ip: var(--jt-success); }
964962
.jt-idea-pill-declined { --jt-ip: var(--jt-text-tertiary); }
965963

966964
/* Roadmap status picker (moderator only on Ideas spaces). Each option

assets/css/jetonomy.css

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -953,14 +953,12 @@
953953
.jt-accepted-callout-head { display: inline-flex; align-items: center; gap: 6px; color: var(--jt-success); font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.02em; text-transform: uppercase; margin-block-end: 8px; }
954954
.jt-accepted-callout-body .jt-reply { background: var(--jt-bg); border: 1px solid var(--jt-border); border-radius: var(--jt-radius-sm); padding: 12px; }
955955

956-
/* Idea roadmap status pill — six canonical statuses, color-coded so the
956+
/* Idea roadmap status pill - four canonical statuses, color-coded so the
957957
listing and post header speak the same visual language as the kanban. */
958958
.jt-idea-pill { --jt-ip: var(--jt-text-secondary); display: inline-flex; align-items: center; background: color-mix(in srgb, var(--jt-ip) 14%, transparent); color: var(--jt-ip); font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: var(--jt-radius-full); letter-spacing: 0.02em; white-space: nowrap; }
959-
.jt-idea-pill-submitted { --jt-ip: var(--jt-accent); }
960-
.jt-idea-pill-under_review { --jt-ip: var(--jt-text-secondary); }
961-
.jt-idea-pill-planned { --jt-ip: var(--jt-warn); }
959+
.jt-idea-pill-planned { --jt-ip: var(--jt-accent); }
962960
.jt-idea-pill-in_progress { --jt-ip: var(--jt-warn); }
963-
.jt-idea-pill-completed { --jt-ip: var(--jt-success); }
961+
.jt-idea-pill-shipped { --jt-ip: var(--jt-success); }
964962
.jt-idea-pill-declined { --jt-ip: var(--jt-text-tertiary); }
965963

966964
/* Roadmap status picker (moderator only on Ideas spaces). Each option

includes/admin/views/setup-wizard.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,20 @@
132132
<span><?php esc_html_e( 'Questions, answers, accepted solution', 'jetonomy' ); ?></span>
133133
</label>
134134
</div>
135+
<div class="jt-radio-option">
136+
<input type="radio" name="jt-default-type" id="jt-type-ideas" value="ideas">
137+
<label for="jt-type-ideas">
138+
<strong><?php esc_html_e( 'Ideas', 'jetonomy' ); ?></strong>
139+
<span><?php esc_html_e( 'Feature requests, voting, planned/in progress/shipped/declined roadmap lanes', 'jetonomy' ); ?></span>
140+
</label>
141+
</div>
142+
<div class="jt-radio-option">
143+
<input type="radio" name="jt-default-type" id="jt-type-feed" value="feed">
144+
<label for="jt-type-feed">
145+
<strong><?php esc_html_e( 'Show &amp; Tell', 'jetonomy' ); ?></strong>
146+
<span><?php esc_html_e( 'Short-form feed for status updates, screenshots, and quick wins', 'jetonomy' ); ?></span>
147+
</label>
148+
</div>
135149
</div>
136150
</div>
137151

@@ -170,7 +184,7 @@
170184

171185
<button type="button" class="jt-btn jt-btn--ghost" id="jt-create-sample">
172186
<?php jetonomy_echo_icon( 'plus', 16 ); ?>
173-
<?php esc_html_e( 'Create sample data instead (2 categories, 4 spaces, 10 posts)', 'jetonomy' ); ?>
187+
<?php esc_html_e( 'Create sample data instead (2 categories, 6 spaces across all four types, ~12 posts)', 'jetonomy' ); ?>
174188
<span class="jt-spinner" style="border-color:rgba(100,116,139,.4);border-top-color:#64748b;"></span>
175189
</button>
176190

includes/db/class-migrator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ private static function get_migrations(): array {
4747
'1.4.1' => '1_4_1',
4848
'1.4.2' => '1_4_2',
4949
'1.4.2.1' => '1_4_2_1',
50+
'1.4.2.2' => '1_4_2_2',
5051
];
5152
}
5253
}

includes/db/class-schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private static function get_table_definitions( string $p, string $charset_collat
156156
is_private tinyint(1) NOT NULL DEFAULT 0,
157157
is_closed tinyint(1) NOT NULL DEFAULT 0,
158158
is_resolved tinyint(1) NOT NULL DEFAULT 0,
159-
idea_status ENUM('submitted','under_review','planned','in_progress','completed','declined') DEFAULT NULL,
159+
idea_status ENUM('planned','in_progress','shipped','declined') DEFAULT NULL,
160160
vote_score int(11) NOT NULL DEFAULT 0,
161161
reply_count int(11) NOT NULL DEFAULT 0,
162162
view_count int(11) NOT NULL DEFAULT 0,
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase, WordPress.Files.FileName.InvalidClassFileName
2+
/**
3+
* Migration 1.4.2.2 - align Ideas roadmap status enum with the documented 4-lane spec.
4+
*
5+
* The 1.4.2 readme advertised four roadmap status lanes (planned, in progress,
6+
* shipped, declined) but the schema and admin UI shipped six lanes from the
7+
* earlier 1.4.2.1 backfill (submitted, under_review, planned, in_progress,
8+
* completed, declined). This migration brings the data and the column type
9+
* into alignment with the readme.
10+
*
11+
* Data remap end-state:
12+
*
13+
* - 'submitted' -> NULL (newly posted ideas live in the space's
14+
* normal feed; they enter the roadmap only
15+
* when an owner explicitly assigns a status)
16+
* - 'under_review' -> NULL (pre-decision state, same semantics as NULL)
17+
* - 'completed' -> 'shipped' (rename only - same meaning, customer-facing
18+
* word "shipped" matches the readme)
19+
*
20+
* Sequence is non-obvious: the new value 'shipped' is not in the old ENUM,
21+
* so we cannot UPDATE rows to 'shipped' before extending the ENUM. Order:
22+
*
23+
* 1. NULL out 'submitted' and 'under_review' rows (still valid values).
24+
* 2. ALTER ENUM to a transitional set that contains BOTH old and new
25+
* ('completed' AND 'shipped' simultaneously) so step 3 can succeed.
26+
* 3. UPDATE 'completed' rows to 'shipped'.
27+
* 4. ALTER ENUM to the final 4-value spec.
28+
*
29+
* Doing the rename through a single ALTER (drop 'completed' + add 'shipped')
30+
* would cause MySQL to coerce existing 'completed' rows to '' (empty string)
31+
* before the UPDATE could rename them.
32+
*
33+
* @package Jetonomy
34+
*/
35+
36+
namespace Jetonomy\DB\Migrations;
37+
38+
defined( 'ABSPATH' ) || exit;
39+
40+
class Migration_1_4_2_2 {
41+
42+
public function up(): void {
43+
global $wpdb;
44+
$posts_table = $wpdb->prefix . 'jt_posts';
45+
46+
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
47+
48+
// Step 1: drop the two pre-decision states. NULL is still permitted
49+
// by the column DEFAULT, so this is a no-coercion update.
50+
$wpdb->query(
51+
"UPDATE {$posts_table} SET idea_status = NULL WHERE idea_status IN ('submitted','under_review')"
52+
);
53+
54+
// Step 2: transitional ENUM that includes both 'completed' and the
55+
// new 'shipped' value, so step 3's UPDATE has a valid target.
56+
$wpdb->query(
57+
"ALTER TABLE {$posts_table}
58+
MODIFY COLUMN idea_status ENUM('submitted','under_review','planned','in_progress','completed','shipped','declined') DEFAULT NULL"
59+
);
60+
61+
// Step 3: rename 'completed' rows to 'shipped'.
62+
$wpdb->query(
63+
"UPDATE {$posts_table} SET idea_status = 'shipped' WHERE idea_status = 'completed'"
64+
);
65+
66+
// Step 3b: rescue rows that were coerced to '' on a previous (broken)
67+
// run of this migration that ALTERed before UPDATEing. Safe no-op on
68+
// fresh installs because '' is not used anywhere as a real value.
69+
$wpdb->query(
70+
"UPDATE {$posts_table} SET idea_status = NULL WHERE idea_status = ''"
71+
);
72+
73+
// Step 4: final ENUM in the documented 4-value form.
74+
$wpdb->query(
75+
"ALTER TABLE {$posts_table}
76+
MODIFY COLUMN idea_status ENUM('planned','in_progress','shipped','declined') DEFAULT NULL"
77+
);
78+
79+
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
80+
}
81+
}

includes/models/class-post.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,15 @@ public static function accept_reply( int $id, int $reply_id ): bool {
583583
* Roadmap statuses an idea (a post on a `type=ideas` space) can be in.
584584
*
585585
* Mirrors the `idea_status` enum in `class-schema.php`. Order is the
586-
* canonical kanban progression — owners typically move ideas left to
587-
* right (Submitted → Under Review → Planned → In Progress → Completed),
588-
* with Declined as the off-ramp.
586+
* canonical kanban progression - owners move ideas left to right
587+
* (Planned -> In Progress -> Shipped), with Declined as the off-ramp.
588+
* Ideas with no status assigned (NULL) live in the space's normal
589+
* feed and do not appear on the roadmap kanban.
589590
*
590591
* @return string[]
591592
*/
592593
public static function valid_idea_statuses(): array {
593-
return array( 'submitted', 'under_review', 'planned', 'in_progress', 'completed', 'declined' );
594+
return array( 'planned', 'in_progress', 'shipped', 'declined' );
594595
}
595596

596597
/**

jetonomy.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Plugin Name: Jetonomy
44
* Plugin URI: https://store.wbcomdesigns.com/jetonomy/
5-
* Description: Next-gen discussion platform for WordPress forums, Q&A, and more.
5+
* Description: Next-gen discussion platform for WordPress - forums, Q&A, and more.
66
* Version: 1.4.2
77
* Requires at least: 6.7
88
* Requires PHP: 8.1
@@ -17,7 +17,7 @@
1717
defined( 'ABSPATH' ) || exit;
1818

1919
define( 'JETONOMY_VERSION', '1.4.2' );
20-
define( 'JETONOMY_DB_VERSION', '1.4.2.1' );
20+
define( 'JETONOMY_DB_VERSION', '1.4.2.2' );
2121
define( 'JETONOMY_FILE', __FILE__ );
2222
define( 'JETONOMY_DIR', plugin_dir_path( __FILE__ ) );
2323
define( 'JETONOMY_URL', plugin_dir_url( __FILE__ ) );
@@ -251,14 +251,12 @@ function jetonomy_space_allows_voting( $space ): bool {
251251
*/
252252
function jetonomy_idea_status_label( string $status ): string {
253253
$labels = array(
254-
'submitted' => __( 'Submitted', 'jetonomy' ),
255-
'under_review' => __( 'Under Review', 'jetonomy' ),
256-
'planned' => __( 'Planned', 'jetonomy' ),
257-
'in_progress' => __( 'In Progress', 'jetonomy' ),
258-
'completed' => __( 'Completed', 'jetonomy' ),
259-
'declined' => __( 'Declined', 'jetonomy' ),
254+
'planned' => __( 'Planned', 'jetonomy' ),
255+
'in_progress' => __( 'In Progress', 'jetonomy' ),
256+
'shipped' => __( 'Shipped', 'jetonomy' ),
257+
'declined' => __( 'Declined', 'jetonomy' ),
260258
);
261-
return $labels[ $status ] ?? $labels['submitted'];
259+
return $labels[ $status ] ?? '';
262260
}
263261

264262
/**
@@ -271,9 +269,11 @@ function jetonomy_idea_status_label( string $status ): string {
271269
* @param string $status One of Post::valid_idea_statuses(), or empty.
272270
*/
273271
function jetonomy_render_idea_status_pill( string $status ): void {
274-
$resolved = '' !== $status ? $status : 'submitted';
275-
echo '<span class="jt-idea-pill jt-idea-pill-' . esc_attr( $resolved ) . '">'
276-
. esc_html( jetonomy_idea_status_label( $resolved ) )
272+
if ( '' === $status || ! in_array( $status, \Jetonomy\Models\Post::valid_idea_statuses(), true ) ) {
273+
return;
274+
}
275+
echo '<span class="jt-idea-pill jt-idea-pill-' . esc_attr( $status ) . '">'
276+
. esc_html( jetonomy_idea_status_label( $status ) )
277277
. '</span>';
278278
}
279279

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ A scale and multisite release. Three new content types finish off, multisite net
271271
**New content types**
272272

273273
* Show & Tell short-form feed spaces. Optional title, inline content cards.
274-
* Ideas spaces ship a real roadmap with statuses (planned, in progress, shipped, declined).
274+
* Ideas spaces ship a real roadmap with four status lanes - Planned, In Progress, Shipped, Declined. Ideas without a curated status live in the space's normal feed and enter the roadmap only when an owner assigns one.
275275
* Q&A spaces let owners pin the accepted answer; an "Answered" badge surfaces on the space list.
276276

277277
**Performance and scale**

templates/views/single-post.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,7 @@ function jetonomy_render_threaded_reply( $reply, $post, $depth = 0, $space = nul
283283
// than a native <select> — same visual language as the
284284
// status pill itself, single click to apply.
285285
if ( $space && 'ideas' === ( $space->type ?? '' ) && $jt_can_moderate_here ) :
286-
$jt_current_status = (string) ( $post->idea_status ?? 'submitted' );
287-
if ( '' === $jt_current_status ) {
288-
$jt_current_status = 'submitted';
289-
}
286+
$jt_current_status = (string) ( $post->idea_status ?? '' );
290287
?>
291288
<div class="jt-idea-status-setter"
292289
data-wp-interactive="jetonomy"

0 commit comments

Comments
 (0)