ideasbugs 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AGENTS.md +1 -1
- data/CHANGELOG.md +21 -0
- data/README.md +11 -3
- data/app/models/ideasbugs/feedback.rb +17 -1
- data/app/views/ideasbugs/feedbacks/_feedback_panel.html.erb +2 -2
- data/lib/generators/ideasbugs/author_type/author_type_generator.rb +34 -0
- data/lib/generators/ideasbugs/author_type/templates/add_author_type_to_ideasbugs_feedbacks.rb.tt +7 -0
- data/lib/generators/ideasbugs/install/templates/create_ideasbugs_feedbacks.rb.tt +1 -0
- data/lib/ideasbugs/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 594b7409df6ee7d74454512af1f913f18a7f9ad3befd898e8914d47da0962129
|
|
4
|
+
data.tar.gz: d984c12493ecc5a100e00f8e091f1f00181cca84dbeb4ac399ef11f222c816e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98a6e17b3a7429697a53bbb780e610f73bfac3e22f14819bb45ee746ad98ee71ba885c5b447b084a9b1b98c826a2665b3da51c920156d72fcb00d698223e5a4c
|
|
7
|
+
data.tar.gz: 10abf57ad59a31f68f347e0c5a1278900a68c3c3080bcf00b8843dcc6bccbb143a95871c42345aa5b9d61c25f9509fa538ed8f4d7818713ad5edda87c01651f7
|
data/AGENTS.md
CHANGED
|
@@ -155,7 +155,7 @@ Everything is optional; a fresh install works with zero config. Full list with c
|
|
|
155
155
|
| No Feedback button | `ideasbugs_tag` missing from the rendered layout, `config.enabled` false, or `show_button = false` with no opener of your own |
|
|
156
156
|
| Submissions rejected with an invalid-token error | The layout is missing `csrf_meta_tags` |
|
|
157
157
|
| No screenshot upload control | Active Storage not installed, or `screenshots = false` |
|
|
158
|
-
| `ideasbugs:tenant` fails on a duplicate column |
|
|
158
|
+
| `ideasbugs:tenant`, `ideasbugs:duplicates` or `ideasbugs:author_type` fails on a duplicate column | They are upgrade generators for older installs; a fresh install already has the column |
|
|
159
159
|
| `undefined local variable current_user` in the initializer | A gate lambda treated its argument as a controller. It is a `request` |
|
|
160
160
|
|
|
161
161
|
---
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.4.0] - 2026-11-10
|
|
6
|
+
|
|
7
|
+
- **Typed authors.** `Feedback.submit` and the widget store the author's class
|
|
8
|
+
in a new `author_type` column next to `author_id`, so a host that files
|
|
9
|
+
feedback from more than one kind of record (a user, an API token, an
|
|
10
|
+
organisation) can tell `User #7` from `Token #7`. Active Record models are
|
|
11
|
+
stored by `polymorphic_name`. The dashboard shows `User #7` when the host
|
|
12
|
+
stores no `author_label`.
|
|
13
|
+
- **Cost:** one nullable string column, no foreign key. Existing installs run
|
|
14
|
+
`bin/rails generate ideasbugs:author_type && bin/rails db:migrate`; until
|
|
15
|
+
then attribution works exactly as in 1.3. Existing rows keep a nil type,
|
|
16
|
+
because the gem cannot know which class their ids belong to: backfill it
|
|
17
|
+
yourself if they share one. No initializer change.
|
|
18
|
+
|
|
19
|
+
## [1.3.1] - 2026-11-10
|
|
20
|
+
|
|
21
|
+
- Fix the dashboard queue under Rails edge Ractor requests. 1.3.0's
|
|
22
|
+
`Feedback.originals` scope raised `Ractor::IsolationError` in a non-main
|
|
23
|
+
Ractor. Normal Rails boots were unaffected. No migration or initializer
|
|
24
|
+
change.
|
|
25
|
+
|
|
5
26
|
## [1.3.0] - 2026-11-10
|
|
6
27
|
|
|
7
28
|
- **Duplicates.** Mark a feedback as a duplicate of another from the dashboard
|
data/README.md
CHANGED
|
@@ -222,7 +222,9 @@ end
|
|
|
222
222
|
|
|
223
223
|
Each row stores `kind`, `section`, `message`, `status` (`open` / `in_review` /
|
|
224
224
|
`resolved`), `page_url`, `user_agent`, an optional `tenant`, and optional
|
|
225
|
-
`author_id` / `author_label`.
|
|
225
|
+
`author_id` / `author_type` / `author_label`. `author_type` is the author's
|
|
226
|
+
class (`polymorphic_name` for Active Record models), so ids from different
|
|
227
|
+
kinds of author cannot be confused. Screenshots are Active Storage attachments
|
|
226
228
|
(`feedback.screenshots`). `duplicate_of_id` points a duplicate at its original.
|
|
227
229
|
|
|
228
230
|
## Duplicates
|
|
@@ -250,6 +252,11 @@ dashboard and keeps its own `status` for when it is unmarked.
|
|
|
250
252
|
`bin/rails generate ideasbugs:duplicates && bin/rails db:migrate`. Until then
|
|
251
253
|
the dashboard works as before, without duplicate controls.
|
|
252
254
|
|
|
255
|
+
**Upgrading from 1.3 or earlier:** run
|
|
256
|
+
`bin/rails generate ideasbugs:author_type && bin/rails db:migrate` to store
|
|
257
|
+
the author's class. Until then `author_type` stays empty. Existing rows keep a
|
|
258
|
+
nil type; backfill it if all your authors share one class.
|
|
259
|
+
|
|
253
260
|
## File feedback from your own API
|
|
254
261
|
|
|
255
262
|
The widget is one way in. If your app already has an API, one endpoint lets
|
|
@@ -297,7 +304,8 @@ curl -X POST https://app.example.com/api/feedback \
|
|
|
297
304
|
the record: check `persisted?` and `errors`. Your endpoint still owns:
|
|
298
305
|
|
|
299
306
|
- **Authentication.** The gem has no tokens of its own. Attribute feedback to
|
|
300
|
-
the token's user so the dashboard shows who sent it.
|
|
307
|
+
the token's user so the dashboard shows who sent it. A token that belongs to
|
|
308
|
+
no user can be the author itself: `author_type` records which it was.
|
|
301
309
|
- **The gates.** `config.enabled` and `config.rate_limit` guard the widget's
|
|
302
310
|
endpoint only. Apply the same rule and a throttle here.
|
|
303
311
|
- **The tenant.** Pass the key `config.tenant` would return for that user, or
|
|
@@ -358,7 +366,7 @@ The following are the model and integration contracts that 1.x will keep
|
|
|
358
366
|
stable under semantic versioning:
|
|
359
367
|
|
|
360
368
|
- `Ideasbugs::Feedback`, including `kind`, `section`, `message`, `status`,
|
|
361
|
-
`page_url`, `user_agent`, `tenant`, `author_id`, `author_label`, timestamps,
|
|
369
|
+
`page_url`, `user_agent`, `tenant`, `author_id`, `author_type`, `author_label`, timestamps,
|
|
362
370
|
`STATUSES`, status helpers/scopes, `newest_first`, `for_tenant`, gated
|
|
363
371
|
`screenshots`, `Feedback.submit`, and the duplicate API (`duplicate_of`,
|
|
364
372
|
`duplicates`, `duplicate?`, `originals`, `mark_duplicate_of!`,
|
|
@@ -47,12 +47,19 @@ module Ideasbugs
|
|
|
47
47
|
before_destroy :release_duplicates
|
|
48
48
|
|
|
49
49
|
# What the queue lists: everything that is not a duplicate of something else.
|
|
50
|
-
|
|
50
|
+
# `klass.`, not a bare call: relation delegation caches the method name on
|
|
51
|
+
# the class, which a non-main Ractor may not write.
|
|
52
|
+
scope :originals, -> { klass.tracks_duplicates? ? where(duplicate_of_id: nil) : all }
|
|
51
53
|
|
|
52
54
|
def self.tracks_duplicates?
|
|
53
55
|
column_names.include?('duplicate_of_id')
|
|
54
56
|
end
|
|
55
57
|
|
|
58
|
+
# Installs before 1.4 lack the column until they run `ideasbugs:author_type`.
|
|
59
|
+
def self.tracks_author_type?
|
|
60
|
+
column_names.include?('author_type')
|
|
61
|
+
end
|
|
62
|
+
|
|
56
63
|
SUBMITTED_ATTRIBUTES = %i[kind section message page_url].freeze
|
|
57
64
|
|
|
58
65
|
# Files feedback the way the widget does: privacy-filtered page URL, author
|
|
@@ -138,9 +145,18 @@ module Ideasbugs
|
|
|
138
145
|
return unless author
|
|
139
146
|
|
|
140
147
|
self.author_id = author.id.to_s if author.respond_to?(:id)
|
|
148
|
+
klass = author.class
|
|
149
|
+
self.author_type = klass.try(:polymorphic_name) || klass.name if self.class.tracks_author_type?
|
|
141
150
|
self.author_label = Ideasbugs.config.author_label.call(author)
|
|
142
151
|
end
|
|
143
152
|
|
|
153
|
+
# What the dashboard shows when the host stores no label: "User #7".
|
|
154
|
+
def author_reference
|
|
155
|
+
return author_label if author_label.present?
|
|
156
|
+
|
|
157
|
+
[attributes['author_type'], "##{author_id}"].compact.join(' ') if author_id.present?
|
|
158
|
+
end
|
|
159
|
+
|
|
144
160
|
# Attaches uploads, or returns the error that rejects them. No screenshots
|
|
145
161
|
# at all is fine.
|
|
146
162
|
def attach_screenshots(files)
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
<dt><%= t('ideasbugs.section', default: 'Section') %></dt>
|
|
54
54
|
<dd><%= feedback.section %></dd>
|
|
55
55
|
<% end %>
|
|
56
|
-
<% if
|
|
56
|
+
<% if (author = feedback.author_reference) %>
|
|
57
57
|
<dt><%= t('ideasbugs.dashboard.from', default: 'From') %></dt>
|
|
58
|
-
<dd><%=
|
|
58
|
+
<dd><%= author %></dd>
|
|
59
59
|
<% end %>
|
|
60
60
|
<% if feedback.page_url.present? %>
|
|
61
61
|
<dt><%= t('ideasbugs.dashboard.page', default: 'Page') %></dt>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rails/generators'
|
|
4
|
+
require 'rails/generators/active_record'
|
|
5
|
+
require_relative '../migration_helpers'
|
|
6
|
+
|
|
7
|
+
module Ideasbugs
|
|
8
|
+
module Generators
|
|
9
|
+
# For apps that installed ideasbugs before 1.4: adds the nullable
|
|
10
|
+
# `author_type` column to ideasbugs_feedbacks, so `author_id` names a
|
|
11
|
+
# record of a known class. A fresh install already gets it. Existing rows
|
|
12
|
+
# keep a nil type; the gem cannot know which class their ids belong to.
|
|
13
|
+
#
|
|
14
|
+
# bin/rails generate ideasbugs:author_type && bin/rails db:migrate
|
|
15
|
+
class AuthorTypeGenerator < Rails::Generators::Base
|
|
16
|
+
include ActiveRecord::Generators::Migration
|
|
17
|
+
include MigrationHelpers
|
|
18
|
+
|
|
19
|
+
source_root File.expand_path('templates', __dir__)
|
|
20
|
+
|
|
21
|
+
desc 'Adds the author_type column to ideasbugs_feedbacks (author type upgrade).'
|
|
22
|
+
|
|
23
|
+
def create_migration_file
|
|
24
|
+
migration_template 'add_author_type_to_ideasbugs_feedbacks.rb.tt',
|
|
25
|
+
'db/migrate/add_author_type_to_ideasbugs_feedbacks.rb'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def post_install
|
|
29
|
+
say "\nauthor_type column queued. Run `rails db:migrate`. Existing rows keep", :green
|
|
30
|
+
say 'a nil type: backfill it yourself if all your authors share one class.'
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -10,6 +10,7 @@ class CreateIdeasbugsFeedbacks < ActiveRecord::Migration<%= migration_version %>
|
|
|
10
10
|
t.string :page_url
|
|
11
11
|
t.string :user_agent
|
|
12
12
|
t.string :author_id
|
|
13
|
+
t.string :author_type
|
|
13
14
|
t.string :author_label
|
|
14
15
|
t.string :tenant # opaque per-tenant key; nil = single global board
|
|
15
16
|
t.references :duplicate_of<%= reference_type_option %>, index: true
|
data/lib/ideasbugs/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ideasbugs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yaroslav Shmarov
|
|
@@ -99,6 +99,8 @@ files:
|
|
|
99
99
|
- docs/screenshots/dashboard-light.png
|
|
100
100
|
- docs/screenshots/widget-dark.png
|
|
101
101
|
- docs/screenshots/widget-light.png
|
|
102
|
+
- lib/generators/ideasbugs/author_type/author_type_generator.rb
|
|
103
|
+
- lib/generators/ideasbugs/author_type/templates/add_author_type_to_ideasbugs_feedbacks.rb.tt
|
|
102
104
|
- lib/generators/ideasbugs/duplicates/duplicates_generator.rb
|
|
103
105
|
- lib/generators/ideasbugs/duplicates/templates/add_duplicate_of_to_ideasbugs_feedbacks.rb.tt
|
|
104
106
|
- lib/generators/ideasbugs/install/install_generator.rb
|