Prior to this commit, we had filtering options for email registration:
1. Specific allowed domains.
2. Implicitly allow all domains if no allowed domains specified.
With this commit, we add another option: The adminstrator may block one
or more domains from registering.
Closesforem/rfcs#281
Don't allow passing `tag[name]=` in post params to admin tag update.
There's no field for this in the view, it's not expected that someone
change the name (it serves as a natural key) - it's preferrable to
alias an old name to a new tag if a renaming is desired.
* Add a failing test for comments index of deleted article
After https://github.com/forem/forem/pull/15052 removed the (also
broken) deleted commentable template and the redirect, requests for
comments from deleted articles raise no method errors (initially
trying to set the page title to "Comments for commentable.title" but
the assumption that @commentable is non-nil is present in several
other places.
This test currently fails (by design). Either we want to update the
controller so that comments from deleted articles are no longer
viewable (returning not found, as we did prior to
https://github.com/forem/forem/pull/5199 or making the view safe for
the case where @commentable is nil and no @root_comment is present.
These requests are happening quite frequently (@maestromac and I
suspect the sitemap may contain these pages and crawlers are visiting
the site from a published link), as evidenced by
https://app.honeybadger.io/projects/66984/faults/81994265
* Add request spec for deleted article scenario
Additionally, relabel the legacy spec (updated during #15052) to
clarify we do not render the deleted_commentable_comment view (this is
testing the comment.path, rather than the article.path/comments index
The scenario with comment.path sets `@root_comment` in the controller,
so does not trigger errors on the `@commentable` method calls.
* Update view
pass 1: get the errors to stop (need to check the rendered page is
also usable, the comment tree is not shown when commentable is nil and
this might be a huge usability/correctness issue).
* extract logic from comments index to methods and update tests
We no longer expect deleted article's comments index to render (should
return 404), only direct links to comments of deleted articles.
Only assign @article in the index for the view if it is in fact an
article (not a podcast episode, it's possible `@root_comment` was for
a podcast episode).
* remove unneeded (and soon to be incorrect spec)
No longer want or need to test for the case where root comment is nil
and so is commentable. This was an exploratory spec (scaffolding) and
can be removed.
* Undo nil safety changes to comments index
and fix typo in comments spec
* Adds a help icon to the creator settings setup page
* Moves the help icon styles from the a tag to the inline_svg_tag
* Removes reused class and aligns help icon to the right
* Refactors help icon out into a partial used across necessary views
* Moves .admin-help-button class from admin.scss to scaffolds.scss
* Adds further utility classes to align help icon as expected
* fix: closing divs and alignments
* fix: closing divs, alignments and add z-elevate
* refactor: remove the confirm email css annd add it to setup_mode
* improve mobile responsiveness
* feat: redirect directly to the new_admin_creator_setting_path from the confirmation email adn the signup
* feat: update the test to no longer show the referral which seems no longer relevant
* fix: update the tests to conform to the new URLS
* update the link
* Caching sum privileged reaction scores
This relates to work on improving the feed. Namely that in the current
proposal in PR #15240 I'm not accounting for how privileged users have
given feedback on an article.
With this change, I will now have a cached value on the articles table
that can be a proxy for how the privileged users have reacted.
In addition there's a small refactor that moves a constant to the
correct scoping object.
Dependent on #15283.
* Fixing method name to `exists?`
Prior to this commit, I was using `exist?` which doesn't work for
ActiveRecord::Relation objects.
* Downcase `followable_type` to fix wrong follows creation bug
* Use `follow_button` helper
* Remove puts statement
* Revert use of follow_button helper
* Remove downcase of followable_type from helper
* Refactor switch case for better consistency
* Add e2e test for follow organization from article page functionality
* Split cypress `it` block into two
* Add additional test to following organizations from dashboard
* Remove downcasing of followable_type for decorated objects
* Fix failing follow back spec
* Force capitalize `followable_type` param
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Update app/controllers/follows_controller.rb
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
This is a hypothetical and experimental interface change. The goal of
the change is to begin looking at what a "Feed"'s method interface would
look like.
I would like to reduce the controller logic necessary for deciding on
different strategies, and instead defer to a builder/strategy lookup
pattern.
* Change display from "created by user" to "reacted to user"
The reaction user_id is the creator (who reacted) and not the
target (reacting to what). On the user edit page, show reactions to
the user, rather than reaction from the user.
* Removing state change and unused method
Prior to this commit, the `@comment_weight` value would change. This is
not ideal as depending on the call sequence, can notably change the
output. I suspect this state change occurred so as to not alter an
underlying spec.
What this change does is remove the state change, removes a dead method,
renames a method (to the dead method name), and leverages
parameterization to better test a spec that was brittle based on
possible state changes.
I believe, from a logical stand point, that this change does not impact
the functionality nor the actual logic that is part of the production
call path.
* Marking methods as @api private
The goal is to highlight that we really shouldn't be calling these
outside of their contained class. Ideally, I'd love to make them
private methods, but there are specs and would prefer to not use
`__send__` to change those specs.
This is a noop change.
* Renaming method to refelct returned param order
Prior to this commit the "default_home_feed_and_featured_story" returned
an array of `[featured_story, default_home_feed]`. The method name and
the order of the returned values were misaligned. This change helps
align the method name and the order of those returned values.
Note, methods such as `each_with_index` have an `element, index`
parameter order.
This is the counter-argument to #15152 - filter in the controller
rather than adding lots of conditional logic to the view to handle the
case where there was a vomit reaction left for a deleted user causing
the moderation reports page to fail to load.
* Fix and clean up podcast pages
* Adjust tests
* Fix a test
* Fix missing i18n
* Fix tests
* Fix tests
* Fiddle with test
* Sure up css and tests
* Add featured as allowed param
* Fix a couple tests
* xit out test
* Update app/views/podcast_episodes/index.html.erb
* Update app/views/podcast_episodes/index.html.erb
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
* When a user is blocked from commenting on an article, show correct error message
* Created new error type ModerationUnauthorizedError and changed error text for it
* Move hard-coded Tags index copy to [en,fr] locale files
* Use tags.pluralize for a better page title implementation
* Add better french translations
* Once more fr translation fix
* Remove .pluralize from title i18n
* tokenize settings menu and add French translations
* add quotes around tokens
* add tokens in alphabetical order
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
* style updates
* author and tools
* overflow hidden for avatars because geeeez
* font smoothing
* reverting little change
* specs
* preview
* css fix
* avatar fix'
* No longer eager load user profile when showing articles.
articles show view no longer needs user profile, as it no longer
renders the user profile preview.
* tags
* tags
* tags reverts
* typo
* dropping initializer for user cards previews on article page
* spec
* remove spec
* revert
* Update app/decorators/article_decorator.rb
Co-authored-by: Michael Kohl <me@citizen428.net>
* Update spec/requests/stories_show_spec.rb
Co-authored-by: Michael Kohl <me@citizen428.net>
* yoloing outline change on buttons because i couldn't see any visual difference
Co-authored-by: Dan Uber <dan@forem.com>
Co-authored-by: Michael Kohl <me@citizen428.net>
* show top tags when search is empty
* add cypress tests
* nudge travis
* tweak to e2e test
* show a 'top tags' heading
* only suggest tags that are supported
* Add supported scope to Tag
Co-authored-by: Michael Kohl <citizen428@forem.com>
* hook up frontend parts
* complete backend, save success alert issues
* fix broken existing specs
* complete snackbar confirmation on page redirect
* rollback success alert; but leave foundation for it in place
* preserve a11y features of snackbar; complete cypress tests
* test redirect after braodcast destroy
* Move logic to determine noindex from view to model
This brings attention to the code and allows for faster unit tests.
I expect we'll be modifying this soon to deemphasize the code tag as a
marker of quality.
* Replace "5" constant with home feed minimum score
* Remove check for "code" tags in low quality article check
This made sense for DEV and other devrel communities, but is no longer
necessary for Forems.
* Add UserExperience setting for minimum index score
- add setting, I used `index_minimum_score` to match the
`home_feed_minimum_score`, `minimum_index_score` feels natural but
breaks the pattern.
- use this to determine whether to include article in the sitemap
- use this to determine whether to add noindex meta to article show page
* Remove unneeded tests
Since there's no longer any check for <code> tags in the body, omit
those tests (which passed anyway).
* Add new setting to admin page
* Admin-configurable display locale
* Add i18n-js and namespacing
* Basic tests and clean up
* A few test adjustments
* Update vendor cache
* Fix a few tests
* Fix a few tests
* Update app/views/articles/_actions.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/articles/_comments_actions.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/articles/_single_story.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/articles/_single_story.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/comments/_comment_header.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/layouts/_sidebar_tags.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/listings/index.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update spec/system/homepage/user_visits_homepage_articles_spec.rb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update spec/system/user/view_user_index_spec.rb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Alphabetical locale page
* Add activerecord custom validation error translations
* Add i18n to webpacker
* Fix a few tests
* Adjust error messages
* Add i18n-tasks
* Adjust JS to get working with jest
* Adjust the way translations are pulled in
* Adjust jest tests
* Remove time localization
* Remove superfluous public js
* Add basic tests for i18n application controller
* Remove unnecessary content
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Constants for controller allowed params
* Apply suggestions from code review
Co-authored-by: Michael Kohl <me@citizen428.net>
Co-authored-by: Michael Kohl <me@citizen428.net>
* Create showModalAfterError function
* Show modal when comments rate limit is reached
* Show modal when article reaction rate limit is reached
* Show modal when follow user rate limit is reached
* Show form error when listing creation rate limit is reached
* Show form error when feedback messages rate limit is reached
* Rename functions for listings rate limit checks
* Show modal when notifications reaction rate limit is reached
* Show modal when picture upload rate limit reached
* Show modal for reactable objects when rate limit reached
* Add and modify tests
* empty commit
* Match modal messages to tests
* Fix error updating Modals
Co-authored-by: Dan Uber <dan@forem.com>