* Initial basic work
* Bulk of related work, including find/replace on the inputs
* Adjust some tests
* Adjust some specs
* Fix a few more tests
* Clean up tests
* Adjust tests
* Test fiddle
* Adjust crop back to be a param
* Update tests
* Set proper defaults
* Fix some styling
* Adjust enrichment logic and tests
* Adjust form JS
* Update test snapshot
* Clean up formatting
* Fix spec name
* Adjust some css and defaults
* Adjust translation for image provider options
* Switch from fill to fill-down
* Proper fallback image
* Fix tests
* Update app/services/images/optimizer.rb
Co-authored-by: Mac Siri <mac@forem.com>
---------
Co-authored-by: Mac Siri <mac@forem.com>
* Adding a field test option for post publishing goals
We have page view and comment view "goals" but have not looked at
publication "goals". We're using these "goals" to help us refine the
feed towards sustainable engagement and community health.
The conjecture on publication goals is that the content on the feed
itself can nudge folks in their decision to publish posts.
Closesforem/forem#17585
* Fixing broken test
* Moving Experiments into AbExperiment namespace
This commit entails two major concepts:
1. Extracting logic out of a worker.
2. Cleaning the conditions in which we convert experiments.
In addition, I revisited some spec names to tidy them up for
clarification and structure.
**Extracting Logic...**
For workers, my preference is that they be a simple router to another
object. A non-worker object, with it's initialize method, can both
better manage instance variables. Further, workers are somewhat "flat"
in hierarchy,
In this case, having the AbExperiment be knowledgeable both in setting
the experiment and handling conversions makes (to me) organizational
sense. For example, the AbExperiment is constructed as a wrapper to the
FieldTest gem. But the RecordFieldTestEventWorker had knowledge of
FieldTest.
With this refactor, it does not have that knowledge. This also provided
an opportunity to replace magic strings with constants.
**Cleaning the conditions...**
This relates directly to and closesforem/forem#17530. I was looking at
the experiments after 2 days, and realized that there shouldn't be
results for
`user_views_pages_on_at_least_nine_different_days_within_two_weeks`;
after all the experiment started 2 days ago, how can we have results
that look at 2 weeks.
By adding the "max" function calls, we ensure a clear boundary of
"before the experiment began" versus "while the experiment is running".
Closesforem/forem#17530
* Update spec/models/ab_experiment_spec.rb
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Apply suggestions from code review
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* First greedy algorithm approach to awarding community wellness badge
* Update app/services/badges/award_community_wellness.rb
I'm sorry I ignored you rubocop. It's still on draft for a reason 😅
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Update app/services/badges/award_community_wellness.rb
Okay, whatever you say rubocop. This line will go away before merging anyways
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Use app/queries/comments/community_wellness_query.rb to replace greedy algorithm
* Query indenting + rename positive_reactions to negative_reactions in EXCEPT
* First step towards query spec
* Fix spec and make it more robust
* Slight cleanup/tweaks
* Badge reward & message
* copy edits + spec improvements + 3 days ago min for query
* Cron update to run daily + small tweak for FeatureFlag use
* inline comment tweaks
* Slight reorder of guard checks in service (FeatureFlag related)
* PR review feedback
* Fix specs from static method refactor
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Conditionally disabling Listings
Prior to this commit, we were assuming everyone still had the Listing's
feature turned on.
With this commit, we move from the "implicitly on" nature of
`FeatureFlag.accessible?` to the "explicitly off" nature of
`FeatureFlag.enabled?`. The key differentiator is that we are not
"pushing out a feature flag setting to other forems." Listings now
become an "opt-in".
This requires a few things:
1) Ensure that DEV.to enables the `:listing_feature` before we deploy
this branch.
2) Communicate this change to other Forem adopters and provide a
timeline for when we'll deploy this change.
3) Documentation. Given that we have this feature, but it will be
disabled by default, we want to look into communicating what it is
and how to enable it.
Further, I chose to do the least effort change on our specs. Namely to
treat the specs as though someone fully enabled the listing feature.
This pull request is a "competetor" to #16423.
Closesforem/rfcs#291
Relates to #16420 and #16461.
* Favoring only setting feature for specific tests.
* Adjusting cypress to avoid listing check
* Removing redundant test based on feedback
* Fixing feature spec
* Fixing cypress test
* Removing a JS message about connect
Related to forem/forem#14734
* Remvoing another reference
I ran `rg Connect[^i]` to see about any remaining references to
Connect. This one seems to be the last.
* Penciling in a Default Spaces section
This delivers two primary things:
1. Extracting shared policy examples
2. Providing a functioning skeleton for toggling on the
"limit_post_creation_to_admins" feature.
Important is that once merged, it would be possible for this code to
"leak" out. But how that leaks out is also how you can test that the
feature works.
First, to orient, there is a constraint for a new route. That
constraint checks if the feature flag exists (e.g. has been explicitly
enabled or explicitly disabled). In other words, at this point, you
can't accidentally enable the feature via the UI. But once you have
enabled the feature, you can then toggle the feature on and off.
So, to test this in the browser:
1. Pull down this branch
2. Run `rails runner "FeatureFlag.disable(:limit_post_creation_to_admins)"`
3. Startup your the web server.
4. Login as an administrator
5. Goto /admin/content_manager/spaces
a. Bask in the glory of a plain HTML form
6. With another browser, login as another non-admin user
7. Go to /settings/extensions, you should see a section Publishing from RSS.
8. Now with the admin's session, update the form to turn on
"limit_post_creation_to_admins"
9. Back to the non-admin browser, refresh /settings/extensions, you
should no longer see the section Publishing from RSS.
Note: I have not included an admin menu item as that is related to and
dependent on some refactors I'm working on (see forem/forem#16888 and
forem/forem#16847). So a bit of "security through obsurity"
Note: In the future, once we resolveforem/forem#16490, we'll start
toggling the "Create a Post" button.
Note: I am not including Cypress tests nor request tests for this
feature because the implementation details related to the testing via
that approach are a little too volitale.
Related to forem/forem#16842
* Updating copy based on forem/forem#16893
* styles
* styles
* dark styles
Co-authored-by: Paweł Ludwiczak <ludwiczakpawel@gmail.com>
* AB Test for Feed Strategy
Adding the plumbing for performing AB Tests on the feed strategy.
You can add the environment variable `AB_TEST_SERVICE_FEED_STRATEGY` to
specify the field test to run.
For example, from the forem application home directory you can run the
following to force a strategy for all users:
```console
AB_TEST_SERVICE_FEED_STRATEGY=original bin/start
```
Forcing the strategy can significantly help with quality assurance testing.
* Adding configurable weighted feed strategy
I wrote about this exploration on [DEV.to][1]. This particular
implementation provides significant configuration options for A/B
testing.
At it's core this `Articles::Feeds::WeightedQueryStrategy` provides a
means to query articles that are relevant to the user. The
configuration helps us test and refine those values.
Further more this implementation introduces the idea of some common
interfaces for feed strategies. I'm not happy with the naming
convention but we can work to change that.
This even hints at a mechanism for administrators to configure.
Related to forem/rfcs#314, as I work towards understanding the feed
algorithm. And #15180
[1]:https://dev.to/jeremyf/practicing-postgresql-and-postulating-improvements-5m
* Renaming AbTestService to AbExperiment
I'm loath to end any production class's filename with "test". I don't
want minitest or rspec coming along and attempting to "test" that file.
In addition, I find that Experiment better describes the concept.
Also, per conversations with Michael K, we favor nouns objects to go
in app/models and verb objects to go in app/services. That's a great
separation.
* Factoring AbExperiment into a Controller concern
I wish this could be a stand-alone module but the implementation of
field test has cases that require controller context.
* Sanitizing configurable weighted strategy cases
* Minor refactoring of coding structure
* Renaming parameter for clarity
* Renaming variable to avoid confusion
Prior to the commit, `env` is a controller variable. The injected `env`
variable didn't collide, but did create just a bit of confusion.
With this change, I'm trying to disentangle from that variable.
* Factoring AbExperiment away from mixin concern
Per discussion with Michael K, we both agree that we do not like
controller concern mixins. They can quickly complicate the legibility
of any given codebase.
This refactor provides a common and simplified interface for a Plain Old
Ruby Object (PORO) that accounts for the implementation considerations
of the underlying "field_test" controller method.
* Adding Datadog.tracer.trace around feed actions
* Adding featured_article_factor
Prior to this commit, there was no consideration for how moderators
engage with an article. This is a first nudge towards that effort.
* Removing spec
Add a spec that says yes or no we're feature testing something seems
fragile. Namely, why are we wanting to assert that as a truism.
* Helping ensure we're "tracing" the same things
From the code comment:
> Hey, why the to_a you say? Because the
> LargeForemExperimental has already done this. But the
> weighted strategy has not. I also don't want to alter the
> weighted query implementation as it returns a lovely
> ActiveRecord::Relation. So this is a concession.
* Addressing parameters for tracing function
* For weight feed query only count positive tags
A user assigns explicit points to the tags that they do or do not want
to see. This change treats the negative explicit_points as an indicator
that they don't want to see the tag.
* Adding weighted factor for privileged user reactions
* Updating comments to better clarify
* Adding additional constraint for published_at
* Updating documentation and adding logger
* Adding documentation concerning method call
* Upping logging level for experiments
See conversations in https://github.com/forem/forem/pull/15240
* Adding group by clauses to appease postgres configs
* Injecting relevant scoring method's joins
Prior to this commit, we included all of the joins regardless of the
scoring methods chosen. With this commit, we only inject joins that are
used with the commit.
What this would allow us to do is to then have some pre-cooked scoring
methods but not turn them on. Or to turn off the more expensive scoring
methods.
* Adding feature flag for feed strategy experiment
* Add feature flag for connect
* Start using Connect feature flag
* Add feature flag check to plaintext mailers
* Minor fixes/formatting issues
* Fix typo
* Enable Connect feature flag for tests
* Fix feature flag in tests
* Update rails_helper
* Fix typo
* (╯°□°)╯︵ ┻━┻
* One more try
* connect announcement
* Use connect feature flag in admin and admin routes
* Add aria-live attribute to announcement
* Undo schema.rb changes
Co-authored-by: Paweł Ludwiczak <ludwiczakpawel@gmail.com>
* Test with Grid layout
* Use Flexbox
* Replace with utility classes
* Wire up Tools -> Emails
* Stash: will rebase with a better commit message
* Fix transition between Email and Tools component
* Refactor Verify Email Ownership button a bit
* Use respond_to for verify_email_ownership
* Wrap the Preact Snackbar controller in Stimulus and use it from users/tools/email_controller
* Add HTML5 validation to EmailComponent
* Validation and cleanup
* Add Email history list and fix styling
* Additional styling cleanups
* Add error handling
* Close panel after email operations
* Actually use <local-time> GitHub time element correctly
* Add specs for Tools component and controller
* Email to Emails
* Add tests for Admin::Users::Tools::EmailsComponent
* Fix bug with ToolsComponent instantiation in ToolsController
* Add notes to show page
* Add ToolsComponent css
* Use Rails UJS instead of manual Stimulus to connect remote helpers
* Make Notes section come alive by adding its code
* Make Credits section come alive by adding its code
* Go back to vertical flex
* Finalize small restructuring of credits code
* Simplify ToolsComponent instantiation
* Add basic Add user to org functionality
* Make update user permissions form work
* Make remove user from org work
* Use generic Stimulus AjaxController to cleanup code
* Use Stimulus AjaxController for NotesComponent
* Use Stimulus AjaxController for CreditsComponent
* Use Stimulus AjaxController for OrganizationsController
* Add Admin::Users::Tools::ReportsComponent
* Do not display snackbar message if there is no message
* Add Admin::Users::Tools::ReactionsComponent
* Fix EmailsComponent spec
* Add CreditsComponent tests
* Fix quotes
* Add OrganizationsComponent specs
* Add ReportsComponent spec
* Add ReactionsComponent spec
* Fix rubocop violation
* Fix ToolsComponent specs
* Remove unused variable
* More tests
* Use keyword argument for ToolsComponent
* Fill in Tools requests specs
* Use Rspec shared_examples for ToolsController and EmailsController
* Add tests for Admin::Users::Tools::CreditsController
* Add tests for Admin::Users::Tools::NotesController
* Add tests for Admin::Users::Tools::OrganizationsController
* Add tests for Admin::Users::Tools::ReactionsController and ReportsController
* Fix bugs and add tests to Admin::OrganizationMembershipsController
* Add comments to deprecated sections of the UsersController
* Fix bugs and add tests to Admin::UsersController #send_email and #verify_email_ownership
* Add User model tests
* Feature flag fixes
* Add Cypress Tools - Emails tests
* Add Cypress Tools - Notes tests
* Add Cypress Tools - Credits tests
* Add Cypress Tools - Organizations tests
* Add Cypress Tools - Reports and Reactions tests
* Mark the replace target as a polite region
* Update view_component gem
* Tiny fixes
* Fix spec
* Wrap component rendering in render_component
* Move user.related_negative_reactions to a Reaction scope
* Move user.reports to a FeedbackMessage scope
* Move user.last_verification_date as EmailAuthorization class method
* Revert encapsulation to private
* Fix boxes backlinks names
* Add keyboard focus styling to boxes
* Remove duplicate styling
* Remove duplicated header element
* Improve heading hiearchy
* Fix <legend> and labels
* Backlink should be Tools not Users
* Announce section change to screen reader and fix focus
* Fix specs
* Add focus style for backlinks
* Enable email sending in e2e mode
* Use Settings instead of env variable
* Replaced granular emails with the default one
* Set reply to header in emails
* Extract shared_examples from NotifyMailer
* Removed unused code
* Replaced SiteConfig with Settings::General
* Fixes related to replacing SiteConfig with Settings
* Removed duplicate line from specs
* Run user setting DUS per-user via Sidekiq
Doing it as a single query trips the query timeout beyond a certain
quantity of users.
* Run DataUpdateScripts::MigrateRelevantFieldsFromUsersToUsersNotificationSettings asynchronously
* Rename SiteConfig
* More renaming
* Update spec
* Update mandatory settings mapping
* More renaming
* e2e test fixes
* You have a rename, and you have a rename
* Spec fix
* More changes
* Temporarily disable specs
* After-merge update
* Undo rename for migration
* undo rename of DUS
* Fix DUS
* Fix merge problem
* Remove redundant DUS
* Fix specs
* Remove unused code
* Change wrong class name
* More cleanup
* Re-add missing values to constant
* Fix constant
* Fix spec
* Remove obsolete fields
* Add accidentally removed field
* Update spec
* Move methods from Settings::General to ForemInstance
* Remove unneeded model
* Change mentions of 'site config'
* Add fakeredis gem
* Mock Pusher::PushNotifications in specs
* Remove Redis from Travis
* Add Android tests to ConsumerApp specs
* Use mock for push notification tests and refactor ConsumerApp and Device code
* Fix remaining broken specs
* Use symbols
* Cleanup rpush helpers
* Pusher::PushNotifications is no more
* Use human friendly platform in Admin::ConsumerApps index page
* Declare winner in feed_top_articles_query test
* Some WIP modifications to lfe
* Fix up tests and generalize
* Fix style
* Adjust tests to handle different field test scenarios
* Remove socre_randomness tests
* Fix test to fit stub
* Update app/workers/users/record_field_test_event_worker.rb
* Prepare to drop profile columns from user
* Update code and factory
* Also remove unused constant
* Move validation from user to profile
* Remove Profiles::ExtractData service object
* Add more comments
* Simplify sameAs attribute generation
* Obey me machine, I am your master
* Fix condition order in guard clause
* Temporarily disable callback
* Fix specs
* Reduce usage of Profile#refresh_attributes!
* Remove leftover comment
* Handle social media links differently
* More spec fixes
* Fix specs for admin profile fields controller
* Fix specs after merge
* Fix remaining specs
* Update user show request spec
* Add comment for follow_hiring_tag
* Only save profile when user is valid
* Fix seeds.rb for profile fields
* Switch from before_save to after_save
* Undo unrelated formattin change
* Update spec/fixtures/files/profile_fields.csv
Co-authored-by: Molly Struve <mollylbs@gmail.com>
* Remove data update script and spec
* Fix spec
* Fix typo in comment
* Fix typo in comment
* Move article resave logic to service object
* Move profile field creation to before(:suite)
* Refactor error handling in Profiles::Update
* Fix Profiles::Update specs and refactor
* Temporarily disable spec
* Add ProfileValidator
* Clean up
* Move DB ready check into app/lib
* Refresh attributes after importing from CSV
* Fix specs
* Remove unused file
* A girl has no name. A profile neither.
* Fix specs
* Add responds_to? check
* Spec fix
* Add name to user fields in profile settings page
Co-authored-by: Molly Struve <mollylbs@gmail.com>
* Allow initial user to sign up and configure app
* Fix added value unneeded
* Make siteconfig public in tests
* Remove deprecated method and adjust seed default
* Add new controllers not to redirect for public
* Modify tests
* Edit test defaults
* Fix linting
* Add starter mode to seed file
* Only bust_fastly_cache if fastly is enabled
* Conditionally bust nginx cache from CacheBuster#bust
* Don't _actually_ call out to openresty
* Remove redundant check for FASTLY_API_KEY in CacheBuster
* Clean up and add a spec
* Do not call .purge_ methods if fastly is not configured
* Add OPENRESTY_ ENV vars to .env_sample
* Remove extra / prepending path
* Remove ConfigurationError, clean up Purgeable concern
* Use raise instead of fail like fastly-ruby
* No longer check for Rails.env.production?
* Use let! to create article in BustMultipleCachesWorker spec
* implement some suggestions from https://github.com/forem/forem/pull/9610
* chore: update the errors based on suggestions
* feat: make query readable on blazer