Skip to content

Commit ac8fc0d

Browse files
committed
fix: seed sample data for ticket detail screenshot and force activation hook
1 parent fafb636 commit ac8fc0d

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

.github/workflows/screenshots.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,88 @@ jobs:
7272
wp plugin activate escalated --allow-root 2>&1 || echo "Plugin activation had warnings"
7373
wp plugin list --allow-root
7474
75+
# Force activation hook to create roles, capabilities, and tables
76+
wp eval 'do_action("activate_escalated/escalated.php");' --allow-root 2>&1 || true
77+
7578
# Ensure the admin user has all Escalated capabilities
7679
wp cap add administrator escalated_manage_tickets escalated_view_tickets escalated_create_tickets escalated_manage_departments escalated_manage_sla escalated_manage_escalation_rules escalated_manage_tags escalated_manage_canned_responses escalated_manage_macros escalated_manage_settings escalated_manage_api_tokens escalated_view_reports escalated_manage_automations --allow-root 2>&1 || true
7780
wp user add-role 1 administrator --allow-root 2>&1 || true
7881
82+
# Seed sample data for screenshots
83+
wp eval '
84+
global $wpdb;
85+
$table = $wpdb->prefix . "escalated_departments";
86+
$wpdb->insert($table, ["name" => "General Support", "is_active" => 1, "created_at" => current_time("mysql"), "updated_at" => current_time("mysql")]);
87+
$dept_id = $wpdb->insert_id;
88+
$wpdb->insert($table, ["name" => "Billing", "is_active" => 1, "created_at" => current_time("mysql"), "updated_at" => current_time("mysql")]);
89+
90+
$tickets_table = $wpdb->prefix . "escalated_tickets";
91+
$wpdb->insert($tickets_table, [
92+
"reference" => "ESC-00001",
93+
"subject" => "Cannot login to my account",
94+
"description" => "I keep getting an error when trying to login. Please help.",
95+
"status" => "open",
96+
"priority" => "high",
97+
"requester_id" => 1,
98+
"department_id" => $dept_id,
99+
"channel" => "web",
100+
"created_at" => current_time("mysql"),
101+
"updated_at" => current_time("mysql"),
102+
]);
103+
$ticket_id = $wpdb->insert_id;
104+
$wpdb->insert($tickets_table, [
105+
"reference" => "ESC-00002",
106+
"subject" => "Feature request: dark mode",
107+
"description" => "Would love to see a dark mode option.",
108+
"status" => "in_progress",
109+
"priority" => "medium",
110+
"requester_id" => 1,
111+
"assigned_to" => 1,
112+
"department_id" => $dept_id,
113+
"channel" => "web",
114+
"created_at" => current_time("mysql"),
115+
"updated_at" => current_time("mysql"),
116+
]);
117+
$wpdb->insert($tickets_table, [
118+
"reference" => "ESC-00003",
119+
"subject" => "Billing question about upgrade",
120+
"description" => "I want to upgrade my plan but have questions.",
121+
"status" => "waiting_on_customer",
122+
"priority" => "low",
123+
"requester_id" => 1,
124+
"channel" => "email",
125+
"created_at" => current_time("mysql"),
126+
"updated_at" => current_time("mysql"),
127+
]);
128+
129+
$replies_table = $wpdb->prefix . "escalated_replies";
130+
$wpdb->insert($replies_table, [
131+
"ticket_id" => $ticket_id,
132+
"author_id" => 1,
133+
"body" => "Hi, thanks for reaching out. Can you share a screenshot of the error?",
134+
"is_internal_note" => 0,
135+
"type" => "reply",
136+
"created_at" => current_time("mysql"),
137+
"updated_at" => current_time("mysql"),
138+
]);
139+
$wpdb->insert($replies_table, [
140+
"ticket_id" => $ticket_id,
141+
"author_id" => 1,
142+
"body" => "Looks like a password reset issue. Investigating now.",
143+
"is_internal_note" => 1,
144+
"type" => "note",
145+
"created_at" => current_time("mysql"),
146+
"updated_at" => current_time("mysql"),
147+
]);
148+
149+
$tags_table = $wpdb->prefix . "escalated_tags";
150+
$wpdb->insert($tags_table, ["name" => "bug", "color" => "#e74c3c", "created_at" => current_time("mysql"), "updated_at" => current_time("mysql")]);
151+
$wpdb->insert($tags_table, ["name" => "feature-request", "color" => "#3498db", "created_at" => current_time("mysql"), "updated_at" => current_time("mysql")]);
152+
$wpdb->insert($tags_table, ["name" => "billing", "color" => "#2ecc71", "created_at" => current_time("mysql"), "updated_at" => current_time("mysql")]);
153+
154+
echo "Seeded: 2 departments, 3 tickets, 2 replies, 3 tags\n";
155+
' --allow-root 2>&1
156+
79157
# Start PHP built-in server
80158
php -S localhost:8080 -t /tmp/wordpress &
81159
sleep 3

0 commit comments

Comments
 (0)