* Add a guard for email message content that does not have an html tag
* Return empty string if content is nil
* Add tests for handling content with and without html tags and nil
* feat: Add a pack file that pulls in the MultiSelect Component
* feat: move the tags to its own component
* save tags
* refactor: create a getCSRFToken function in the packs files so that it can be used in the admin
* feat: import the new module in request.js
* feat: remove unnecessary id
* feat: first pass of csrf token test
* chore: update the test
* fix: csrf token
* feat: hide the enw functionality behinda feature flag
* fix: loading form twice
* refactor: import for csrftoken
* chore: update the description of the function
* feat: use acts_on_taggable to craete a relationship between display_ad and tag
* feat: add a tag field to the display_ad form
* feat: add the selected tags from the multiselect autocomplete component to the input text field that references the tag_list
* feat: add the tag_list to the controller so that we can save it to the db with the display ad parameters
* feat: pull out the tag validation from the article and the display_ads into a concern
* feat: write soem tests for validating the tag on the display_ads model
* feat: add the tag_list as a hidden field
* feat: set the selected tags on edit
* feat: add a js class for the placement area
* feat: use the change in the dropdown to determine whether we show the tags field dropdown
* refactor: rename and brak up fucntions
* feat: show the tags field if the value of the placement area is already set
* fix: move if statement out of the change event
* feat: hide tags field and clear the tag list
* refactor: delete the display ads
* tests: ensure that we test the toggle
* fix:ensure that the tags on the hidden field show up as a string in the input field
* feat: update the jsdoc
* fix: no need to replace space with comma since we showing as string in form
* feat: update the name of the label
* fix: add hidden back
* feat: add cached_tag_list to displya_ads + the index
* feat: udpdate the schema
* refactor: move the scopes into the a module that can be re-used between display_ads and articles
* feat: account for showing display ads with the targeted tags that match the article
* feat: write a spec to show the correct ads based on the article_tags
* refactor: change TagListValidateable to Taggable and move out the not_cached_tagged_with_any scope
* test teh relationship between display ads and tags
* feat: write soem tests for validating the tag on the display_ads model
* chore: change empty to blank
* feat: will show display ads with no tags set if there are no article tags
* feat: add a newline
* Try a ReactionCategory abstract 'model'
* Use ReactionCategory
* Lookup category, pre-reaction
* Lookup category > constant
* Category can sometimes be nil?
* Try something friendlier for code reloading
* Refactor: extract point calculation out of Reaction
* Reaction Category can have color
* Rename reaction points service to follow convention
* method signature changed as well, calculate -> call
* Fix typo, leading comment, and rename data structures for clarity
* feat: Add a pack file that pulls in the MultiSelect Component
* feat: move the tags to its own component
* save tags
* refactor: create a getCSRFToken function in the packs files so that it can be used in the admin
* feat: import the new module in request.js
* feat: remove unnecessary id
* feat: first pass of csrf token test
* chore: update the test
* fix: csrf token
* feat: hide the enw functionality behinda feature flag
* fix: loading form twice
* refactor: import for csrftoken
* chore: update the description of the function
* feat: use acts_on_taggable to craete a relationship between display_ad and tag
* feat: add a tag field to the display_ad form
* feat: add the selected tags from the multiselect autocomplete component to the input text field that references the tag_list
* feat: add the tag_list to the controller so that we can save it to the db with the display ad parameters
* feat: pull out the tag validation from the article and the display_ads into a concern
* feat: write soem tests for validating the tag on the display_ads model
* feat: add the tag_list as a hidden field
* feat: set the selected tags on edit
* remove rack attack throttle for admin users
* Add tests
* Optimize cache admin secrets for 24h with invalidation when needed
* Make ApiSecret callback only execute on create
* feat: remove initializeSponsorshipVisibility and related code
* feat: remove sponsorships from sidebar
* feat: remove sponsorships from the admin - route, controller, view, spec
* feat: remove the admin menu item
* feat: remove the i8n for admin sponsors controller
* feat: sponsorship decorator was not being used anywhere
* feat: sponsorship slack messenger was not being used anywhere
* feat: remove the sponsorship_headline that gets configures on the admin
* feat: remove the /sponsors page
* feat: remove renedring of single_sponsor partial and associated partials
* feat: remove the navigation link rake task for sponsors
* feat: remove sponsorship from tags
* feat: remove i8n constants used
* remove sponsor references in text to the privacy page
* feat: remove the sponsorship detail from the organization page
* feat: remove the sponsors css that was used for app/views/pages/sponsors.html.erb
* feat: remove the sponsorship i8n that was used in the slack messengers
* feat: swap out the decorators to use Article as an example
* feat: remove spec to show sponsors on home page
* feat: update the specs to use Article Decorator instead of the Sponsorship Decorator
* fix: use direct and not all
* fix: remove tests for tag sponsorship
* fix: remove organization sponsorship test
* feat: remove more i8n
* remove unused css from app/views/organizations/_sidebar_additional.html.erb
* feat: remove sponsorship relationship from tag and organization
* remove seed
* feat: remove all Sponsor related specs
* feat: remove model, associated i8n and specs
* feat: remove sponsor from navbar
* feat: add a guard clause if we're unable to constantinize the purchase_type
* feat; remove sponsorship related tests
* feat: remove sponsorship relationship
* feat: remov especs related to sponsorship
* feat: remove tag sponsorship validation
* feat: remove the sponsorship factory
* feat: remove initializeSponsorshipVisibility and related code
* feat: remove sponsorships from sidebar
* feat: remove sponsorships from the admin - route, controller, view, spec
* feat: remove the admin menu item
* feat: remove the i8n for admin sponsors controller
* feat: sponsorship decorator was not being used anywhere
* feat: sponsorship slack messenger was not being used anywhere
* feat: remove the sponsorship_headline that gets configures on the admin
* feat: remove the /sponsors page
* feat: remove renedring of single_sponsor partial and associated partials
* feat: remove the navigation link rake task for sponsors
* feat: remove sponsorship from tags
* feat: remove i8n constants used
* remove sponsor references in text to the privacy page
* feat: remove the sponsorship detail from the organization page
* feat: remove the sponsors css that was used for app/views/pages/sponsors.html.erb
* feat: remove the sponsorship i8n that was used in the slack messengers
* feat: swap out the decorators to use Article as an example
* feat: remove spec to show sponsors on home page
* feat: update the specs to use Article Decorator instead of the Sponsorship Decorator
* fix: use direct and not all
* fix: remove tests for tag sponsorship
* fix: remove organization sponsorship test
* feat: remove more i8n
* Make user_id optional for DisplayAdEvent
* Track when DisplayAd is visible to user
* Tidy up a bit
* Deleting a user account should nullify related DisplayAdEvents
* Update tests with new association details
* Sort comments in articles page
* Clickable area in sort comments article is now more approriate
* Comments subtitle is now responsive in articles page
* Consider comments sort order for cache in articles page
* On selecting sort option the refreshed page lands to comments section
* feat: add a migration that creates a display_to column on the display_ads table
* feat: add an enum for display_to
* feat/WIP: add rough draft of the field to the UI and permit it in the controller
* feat: take into account on whether an ad needs to be shown on logged in or out or both + update cache keys on sign in
* fix: if a user is not signed in then we want to display all and logged out
* fix: display_for spec in model
* feat: add some tests for display_to
* feat: style the label
* feat: show the display_to on the index page
* feat: add a seed for e2e
* chore: force true
* feat: create a migration to add the display ad name column to the tanle
* feat: add a display ad name to the interface
* feat: add a display ad name after create
* feat: whoops the migration file
* feat: add a DUS to update previous Display Ads names
* fix: test
* refactor: update the name after_save
* fix: add name to params
* Don't change published_at for articles that have already been published (even if unpublished later)
* Removed unused code related to changing published_at
* Added specs for updating published_from_feed articles, fixed specs
* Removed old validation
* Added specs for article validation published_from_feed
* Added and reorganized specs for the Article model (setting published_at)
* Remove the commented code, added a spec
* Added specs for unpublishing
* Removed unused update_published_at from article attributes spec
* Fixed nullifying published_at seconds when republishing from rich editor
* Allow published_at to be within 15 minutes, not 15 hours
* Fixed creating past articles in the specs
* Fixed one more spec with a past article
* Use ActiveSupport's helper instead of computation
Co-authored-by: Fernando Valverde <fernando@fdo.cr>
Co-authored-by: Fernando Valverde <fernando@fdo.cr>
* Try renaming moderator -> super_moderator
* Still finding 'moderator' words
* Fixes for failing specs
* Update test with new role name
* Update app/services/moderator/manage_activity_and_roles.rb
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* 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>
* Adding more context to `/admin/abtests`
Prior to this commit, the `/admin/abtests` was fully rendered by the
field_test gem (see
https://github.com/ankane/field_test/blob/master/app/views/field_test/experiments/index.html.erb
and
https://github.com/ankane/field_test/blob/master/app/views/field_test/experiments/show.html.erb).
With this commit, we're pre-pending our own
partial (e.g. `app/views/field_test/experiments/_experiments.html.erb`)
in the view paths; which means instead of rendering
https://github.com/ankane/field_test/blob/master/app/views/field_test/experiments/_experiments.html.erb
we render our newly created
`app/views/field_test/experiments/_experiments.html.erb`)
Why the ugly antics in the view? As I'm not fully certain if this will
"meet" the full needs of those monitoring the experiments. I'm also
constructing this to most closely match the spreadsheet that has been
assembled for tracking this information.
Why introduce another caching layer for the variant assembly? The
original caching
layer (e.g. `Articles::Feeds::VariantAssembler.pre_assembled_variants`)
is in place to provide the quickest access to the assembled variants.
But due to the nature of the implemented view, we are needing a
programmatic representation of all variants. And the added Rails cache
is there to minimize disk reads.
Closesforem/forem#17820
* Update app/models/articles/feeds/variant_assembler.rb
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Update app/models/articles/feeds/variant_assembler.rb
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Prior to this commit, as a matter of undocumented practice, we would
overwrite past experiments with upcoming experiments.
With this commit, we're leveraging a feature of the field_test gem:
declaring a winner. Instead of overwriting an experiment with the next
experiment, we're going to declare the expiring experiment's winner then
prepend to the ./config/field_test.yml the new experiment.
The [field_test/app/views/field_test/experiments/index.html.erb][1] then
uses logic to first render "active" experiments and "completed"
experiments. A "completed" experiment is one in which we've declared a
winner.
Closesforem/forem#17816
[1]:https://github.com/ankane/field_test/blob/master/app/views/field_test/experiments/index.html.erb
* added ability to assign moderator role via admin/super admin
* create Mod User in seeds
* add Cypress specs
* fix failing Cypress tests
* fix failing specs by moving test Mod user to the end
* nudge Travis
* nudge Travis
Co-authored-by: Arit Amana <msarit@gmail.com>
With comments, publishing articles, and reactions we had symmetry on two
goals:
- Create a _subject_ (e.g. Comment, Published Article, Reaction)
- Create four _subjects_ within a week.
For page views we only had "Create four _subjects_ within a week." This
PR addes the "Create a _subject_".
To do this required adjusting some tests as they were too specific in
nature (looking at an expected count).
In addition, in consultation with Jennie, I've updated the experiment
order to better reflect some hierarchical importance.
**Rollback considerations:**
This also includes a feature flag that we can explicitly disable if we
overload the application with workers handling reaction goals. Using
`FeatureFlag.accessible?(:field_test_event_single_create_pageview)`
returns `true` unless we explicitly disable this flag.
Related to forem/forem#17673
Related to forem/forem#17669Closesforem/forem#17691
This commit adds three new feed experiment goals:
* user publishes four posts within a week
* user reacts with a "heart", "unicorn", or "reading list" to an article
* user reacts with a "heart", "unicorn", or "reading list" to an article
four times in a week
In addition it adds it to the existing experiment. Adding it to the
existing experiment is acceptable because:
1. We can ignore the results
2. The experiments are structured such that these new goals could be met
with prior data.
3. Both variants are playing by the same rules, so the results relative
to each other are valid.
**There is a nuanced assumption in how we handle reactions:**
This implementation does not count by unique article reactions. However,
most folks will ❤️ , 🦄 , and 🔖 in one swoop; thus
those 3 reactions are all grouped into happening on one day.
Further, it's a reflection of the person taking an action after reading
a post, not how much action on that particular post.
**Rollback considerations:**
This also includes a feature flag that we can explicitly disable if we
overload the application with workers handling reaction goals. Using
`FeatureFlag.accessible?(:field_test_event_for_reactions)` returns
`true` unless we explicitly disable this flag.
Closesforem/forem#17669
The [`ArticlePolicy#moderate?`][1] method answers the questions around article
moderation.
At present this change does not introduce any significant changes (aside
from the JS logic loop). The next "step" is to adjust the
`ArticlePolicy#moderate?` method to test if the user has a moderator
role.
Further, we'd need to see what is available on the action panel.
Related to forem/forem#17606
[1]:5ac3216a5a/app/policies/article_policy.rb (L160-L174)
* Adding new relevancy lever for privileged reactions
This PR includes four changes:
1. Renaming the variant to remove Jennie's name
2. Starting a new experiment
3. Adding a new relevancy lever
4. Adding a new variant that uses the relevancy lever
1 and 2 is somewhat straight-forward.
For 3, we're looking at having a total of 5 "slots" for privileged user
reactions. Hence the four boundary values.
For 4, we're configuring the granular levers with the following:
- `[-∞..-5)` should have a 0.05
- `[-5..0)` should have a 0.5
- `[0..5)` should have a 0.9
- `[5..10)` should have a 0.98
- `[10..∞)` should have a 1.0
The 20220509-variant.json is a copy of 20220422-variant.json but
replaces the `privileged_user_reaction` lever with the
`privileged_user_reaction_granular` lever.
Below is the diff to highlight the similarities and differences between
the two variants.
```shell
❯ diff config/feed-variants/20220509-variant.json config/feed-variants/20220422-variant.json
90c90
< "privileged_user_reaction_granular": {
---
> "privileged_user_reaction": {
92,96c92,93
< [-2, 0.05],
< [-1, 0.5],
< [0, 0.9],
< [1, 0.98],
< [2, 1]
---
> [-1, 0.2],
> [1, 1]
98,102c95,97
< "fallback": 0.9,
< "very_negative_reaction_threshold": -5,
< "negative_reaction_threshold": 0,
< "positive_reaction_threshold": 5,
< "very_positive_reaction_threshold": 10
---
> "fallback": 0.95,
> "negative_reaction_threshold": -10,
> "positive_reaction_threshold": 10
```
Closesforem/forem#17584
* Update app/models/articles/feeds.rb
Co-authored-by: Josh Puetz <josh@dev.to>
* Adjusting testing logic to reflect latest experiment
* Adjusting negative threshold
Co-authored-by: Josh Puetz <josh@dev.to>
* 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
Prior to this commit, the SQL fragments included variables that were set
configured at a global level.
With this commit, we're now saying that each lever "knows" what variable
it needs; and providing the means at lever declaration time to "say"
what those variable names are. (e.g. `Articles::Feeds::LEVER_CATALOG`).
Then as part of the variant configuration (in the
`./config/feed-variants/*.json` files) we now include the expected value
of those parameters; which by convention (and coercion) are integers.
This relates to forem/forem#17584 because we want to move from a
privileged user reaction that has two values (`negative` and `positive`)
into four values (`very_negative`, `negative`, `positive`, and
`very_positive`). To do that, we'll create a new lever; but that's for
another pull request.
* 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>