Prior to this commit, we may have left lingering podcast entries that
required manual cleanup. As a bonus, I also added deleting podcasts
when we delete users.
Closesforem/forem#18041
In addition I adjusted rubocop to not complain about the require method call
```
spec/services/users/delete_spec.rb:1:1: C: \
Style/TopLevelMethodDefinition: \
Do not define methods at the top-level. \
(https://rubystyle.guide#top-level-methods)
require "rails_helper"
^^^^^^^^^^^^^^^^^^^^^^
```
* Allow trusted user to access response templates
* Add request specs for trusted user templates
* WIP: was just investigating...
* Move permission check to authorizer
* Revert "WIP: was just investigating..."
This reverts commit c38c60f7ab19ce43c174729c2542a9041e9322e2.
* Improved accessibility
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* show the toolbar (WIP - includes some hacks and todos)
* allow calling component to pass additional toolbar elements
* add templates behaviour
* get templates working
* tweaks following mention autocomplete refactor
* remove image upload handler no longer needed
* rename method
* some small refactors
* only comment text area controls visibility of templates area
* fix error in role name
* fix mobile view
* update specs
* WIP: new autocomplete, search executed, dropdown positioned
* WIP: most features working in Editor
* handle textarea blur
* fix bug with id not attached to textarea
* updates to textAreaUtils tests
* aria live, fix border style
* replace comment text area
* fix some height and style issues
* update preact tests
* clean up styles, rename files, use portal for popover
* clean up styles, rename files, use portal for popover
* scroll popover items into view if necessary
* refactor cypress specs
* actually remove the package
* add some more specs
* remove storybook stories for now
* remove relative class causing issues
* small fixes for cypress specs
* make live region assertive to ensure change to combobox is known
* some comments
* add a storybook story
* replace % font size, add explainer to story
* Article query spec for scheduled articles
* Added scheduled article badge on the user dashboard
* Added published_at field to editor options
* Accept and validate published_at from editor
* Refactor published_at validation
* Allow 1-minute difference in published_at
* Notice on an unpublished article page
* Added specs for 'Click to edit' link on scheduled article preview page
* ContextNotification model
* Articles::Publish worker
* Added specs for articles publish worker
* Schedule publish articles worker
* Added tests to check for scheduled posts in feeds
* Don't allow managing scheduled articles
* Don't send notifications for scheduled articles
* Set published_at in Articles::Updater when publishing
* Published_at value in post options
* Pass timezone and set published_at accordingly
* Limit setting published_at to the future
* Readonly published_at for articles that were already published
* Chagning published_at format in editor v1 (start)
* Changed published_at format in frontmatter, specs
* Added specs for updating published_at from frontmatter
* Fixed accepting past published_at for articles published_from_feed
* Enabled published_at validation: don't allow updating published_at for already published articles
* Validate published_at on create
* Added a spec for updating published_at for exported articles
* Fixed specs related to creating articles with past published_at
* Fixed specs related to past published_at for articles
* Added a hack so that admins would be able to update published_at
* Switch button text schedule/publish when changin publishedAt
* Fixed saving published_at with timezone
* Added a feature flag for scheduling articles
* Default text in markdown editor depends on feature flag
* Enable article editor cache again
* Fixed the default value in the markdown editor
* Fix sitemaps spec
* Removed tooltip
* Fixed articles update specs
* Added missing locales
* Fixed article create specs
* Fixed spec
* Removed commented code
* Returned enabling extensions in the schema
* Returned accidentally deleted constraint
* Make articles query spec more stable
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
* Removed commented code
* Removed unused code
* A clearer policy
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
* Use StringInquirer for article current state
* Added a note and todo to articles factory past trait
* Remove duplicated PropType
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Refactor query in the Articles::PublishWorker
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Refactor articleForm.jsx
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Removed specs that are no longer relevant
* Removed useless onKeyUp on a hidden input
* Refactored articleForm
* Hide scheduling from post options when published_at is readonly
* Run sends notifications worker every 5 minutes instead of every minute
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
This is a "quick and dirty" hack. Do I like it? No. Do I want to delve
into further debugging/refactoring of [a 72 line method][1]? Not at the
moment. There are a few pathways forward, but for now, this is the
pathway to hopefully give us insight into the
**Why will this likely address the issue?**
Prior to this commit, for an experiment we would render each of the
goals (anywhere from 8 to 11); each of which would require 2 expensive
queries; which means about 16 expensive queries.
After this commit, the experiment page has none of those expensive
queries; instead each goal now runs the 2 expensive queries.
The hope is that this will help us show the results (albeit on multiple
pages) while coming in under the response time out handlers we have in
place.
**Why no tests?**
Ugh; I know right?!? I'm beginning to ask that myself. But for now,
because this is only visible to tech_admins, the consequences of
breaking are limited. In otherwords, this is not a customer facing
feature, so it can be a bit less robust in it's testing. At least
that's the rationalization I'm establishing.
Further, local tests would not reveal the production environment
complications of large data sets. The aforementioned expensive queries
are blisteringly fast on my local machine...in part because I don't much
field_test experiment data.
Closesforem/forem#17981
Related to:
- forem/forem#17895
- forem/forem#17869
[1]:ab2d7d29d0/lib/field_test/experiment.rb (L98-L160)
* Adds the Adjust credit balance modal to index view
* Adds e2e tests for adjusting credit balances via modal
* Adds the ability to update credits to #user_status
* Adjusts the e2e to address failures
* Move .skip_confirmation! call to .find_or_create_user! method
* Add regression tests to avoid email confirmation delivery
* Keep the original place where we had user.skip_confirmation! too
* Update logic to require email confirmation from omniauth
* test confirmation is required with SMTP
* Keep :notice instead of :global_notice
* Forem Account bypass email confirmation reorg
* inline comment reorder + clarification
* Apply suggestions from code review
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* refactor: use the DefaultSelectionTemplate to list out the items
* refactor: rename function so that we map it to the deselect item event
* feat: first pass of adding edit functionality
* feat: update the name of the function from clearSelection to clearInput
* feat: setup the edit state by ensuring that we set the editValue and the inputPosition and then use useEffect to monitor changes
* chore: remove the old method in favour of a shared component
* feat: set the order of the items
* refactor: rename handleBlur function name to handleInputBlur
* feat: ensure that the edit field gets resized according to its current input
* feat: oops add inputSizerRef
* feat: when an item is being edited we need to ensure that it gets set back into the correct position and that we clear the previous state
* feat: handle the actual resizing fo the field on an input edit
* feat: use a shared DefaultSelectionTemplate for both the multiautocomplete and the multiinput component
* feat: make the defaultSelectionTemplate customizable based on the variant adn the classname
* feat: pressing backspace will start editing a previous selection if there is one
* feat: read out the selected items as its removed or edited
* feat: pass the regex through as a prop
* feat: move the functions around
* feat: add screen-reader only class
* Update app/javascript/crayons/MultiInput/__stories__/MultiInput.stories.jsx
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* Update app/javascript/crayons/MultiInput/MultiInput.jsx
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* feat: add the props to JSDoc
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* show the pills
* clicking pills removes filter
* add some more spacing
* another alignment tweak
* add cypress spec
* put it behind the feature flag
* make the clear all link a button for consistency
* tweak to comment for clarity
* show the organizations checkboxes
* apply clear filter button and indicator
* filter by org in users query
* add some rspec tests
* add cypress specs
* correct cypress spec
* Fixing UsersQuery to ensure singular user by organization
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
* tweak for smallest viewport
* layout essentially there
* conditionally toggle what the filter button triggers
* contain width of filter section on large screens
* reinstate old view depending on feature flag status
* add type: button (woops)
Prior to this change, we setup our feed variant query to have a cached
randomization seed. For a given user this seed is cached for 15
minutes. The goal of this is to provide mostly consistent sort orders
on the feed articles during that 15 minute window.
With this change, we allow for a feed variant to say ignore the cached
seed and generate a new one for this call.
I have also added explicit settings to each of the feed variants to
reflect our desired intentions for those features.
Relates to
- forem/forem#17833
- forem/forem#17826Closesforem/forem#17940
* prevent ID conflicts in filters modal by caching content
* show roles with expandable section
* minor tweak
* don't use the hidden field
* send array of role
* role -> roles. small refactor
* set initial checked status
* show an indicator when a filter is applied
* add JS to toggle filter clear buttons and indicators
* update some comments, make sure users only appear once in list
* add some cypress specs, fix some bugs
I had looked at using `User.with_any_roles` but that creates one User
query per role passed. Which is not ideal, given that we want to have
an ActiveRecord::Relation object on which we'd paginate.
This adjustment does it's best to mimic Forem's role structure and
adhear to how Rolify builds the underlying query.
An astute reader will notice that in these specs we use `role: "admin"`
and `roles: ["Admin"]`; the primary reason relates the user interface
being worked on in forem/forem#17884. It is my understanding that the
`role` approach and `roles` approach will be separated by a feature
flag (we're rolling out the `roles` approach).
Related to
- forem/forem#17491
- forem/forem#17884
* Adds an Add Organization modal and e2e tests for the modal
* Conditionally redirects to the correct view upon adding org
* Combines modal tests within userIndexView.spec.js
* Removes redundant code and switches assign role and add org button positions
* Updates RSpec tests to account for conditional redirection
* Lowercases the o in organization within _user_actions_dropdown.html.erb
* Fixes failing e2e tests
This change introduces several things things:
1. Fixes the performance of the `/admin/abtests` page; instead of
rendering all of the experiment results, just render the overview.
2. Adjust the show page for an experiment to show the summary of
results.
3. Favor the existing "started_at" and "ended_at" attributes of
FieldTest (see https://github.com/ankane/field_test#config)
4. Update the field test experiments to include the `started_at` and
`ended_at` attributes.
5. Skip processing all non-active experiments in our conversion handler.
Why are there no tests? This is a page that is Admin only and is only
visible for reporting purposes. So, it's not quite worth writing tests
as you'd need lots of data. So we'll assume the logic from the upstream
[field_test gem][1] is adequate.
Closesforem/forem#17869
[1]:https://github.com/ankane/field_test
In the general sense we have an existing `order by` that follows the
following format: `order(x) = f(x) * rand() ^ ( 1 / g(x))`
For the present [20220603-variant-b][1], `g(x)` is the article’s score.
And `f(x)` is 1.
This pull request introduces a few named variations for the above
`order(x)` formula.
The three named formats each use a different `g(x)` function; namely
`greatest(0.1, ln(1 + greatest(0, public_reactions_count)))`. The more
public_reactions the article has the closer to zero the resulting
positive number will be. And raising a random number, with range
`(0..1)`, to the inverse of that number will tend to mean that artciles
with many reactions will tend to group towards the higher end of the
random range, whereas articles with few reactions will have a more even
distribution across the range.
Further the `ln` function helps dampen the weight we give to reactions.
The variation within these three order levers is on the `f(x)` portion:
1. Using `published_at`
2. Using `last_commented_at`
3. Using a mix of `published_at` and `last_commented_at`
In all cases, those dates are converted to an integer. A date 2 weeks
ago will result in a number less than a date 1 week ago which will be
less than a today.
The idea for the mix of `published_at` and `last_commented_at` is to see
a mix of things where some “older” articles (from the underlying result
set) will get a chance to show up earlier in the feed.
My rational for this order structure is because the `RANDOM() ^ (1 /
score)` is showing possible success in a current experiment. And in
past trials long past, it rose to the top as a likely and viable
contender.
These new `order_by` lever patterns introduce three things:
1. A variable based on a date in time
2. A dampening of what can be a large number; (we have scores in the
publication range that are between -200 and 750 so I think it is
important to apply a dampening. For example `(0.1 ^ (1/100)) =
0.977` and `(0.01 ^ (1/100)) = 0.955`; in other words these large
scores aggressively pushed their corresponding posts to the top of
the relevance; even as we weren't explicitly querying for those
scores.
3. With the score being quasi-magical, it doesn’t make sense to sort on
that value but to instead sort on a property that represents what
we’re setting as our experiment goals (e.g. publishing something or
commenting on something and/or reacting to something)
Note: it would be feasible to extract these into a singular order lever
that we would configure. But that's a future concern.
Also note, none of these are yet part of any experiment, but are instead
being "queued up" to add to our available corpus.
Closesforem/forem#17834
Related to:
- forem/forem#17827
- forem/forem#17826
- forem/forem#17833
- forem/forem#16128 :: for past order queries to seek as inspiration
[1]:https://github.com/forem/forem/blob/main/config/feed-variants/20220603-variant-b.json
* Adds the Assign Role modal to the Member Index View
* Adds e2e tests for the Assign role modal
* WIP: Conditionally redirects to the correct view upon assigning a role
* Conditionally renders the redirect in the correct method :|
* Adjusts the conditional redirect to account for ID
* Adds an even more explicit check for the correct refferer
This is uncalled code. We instead use
`Spam::Handler.handle_article!` (see
[Article#create_conditional_autovomits][1]) for usage.
```shell
❯ rg ArticleHandler; echo $?
1
```
The above command shows for the "after this commit" state that there are
no mentions of the `ArticleHandler`. The `1` is the exit status of the
`rg` (e.g. `ripgrep`). A 1 exit status means no matches found.
[1]:bea711310e/app/models/article.rb (L915-L917)
Relates to forem/forem#15412