Commit graph

6563 commits

Author SHA1 Message Date
Jeremy Friesen
034ec6e3fe
Introducing the Articles::Feeds configurations (#17314)
**tl;dr** This PR is looking to provide a means to programmatically
assemble, from system configurations, what is currently the
[Articles::Feeds::WeightedQueryStrategy::SCORING_METHOD_CONFIGURATIONS][1].
Once we merge this PR, instead of having that constant, we'll initialize
the Articles::Feeds::WeightedQueryStrategy with the variant
configuration that we've assembled.

**Introduction**

This pull request has quite a bit going on, but as of now the production
code does not use any of it.

*Note: None of this code is bleeding into production code paths.*

Put your Ruby hat on and let's go for a ride.  And apologizes for not
making this a smaller pull request.  As I built this, I made many small
commits, but this became the smallest commit that provided the most
context without integrating into production code.

Before we get started, you may want to familiarize yourself with where
we're going.  The `./app/models/articles/feeds/README.md` provides
further guidance; but fair warning reader, I have not reconciled the
README's language with what emerged as I wrote this pull request.

Those of you who are part of Forem Core team, you can read the
[Refinements to Our Present Feed Configuration][2]
to provide some insight into what's happening.

**Why not reconcile?** *Because I want to have all of the language and
thoughts available for you to help consider how best to name and model
this.*

**On to the Review**

The purpose of this pull request is to provide a mechanism for
engineering to provide a series of variant query levers.  And to allow
us to easily configure those available query levers into a variant
query.

*Why the mix of Ruby configuration and JSON?*

The Ruby levers are meant to indicate that this is code we don't want to
expose in text based configuration because it might create SQL inject
points.  (More on that when we integrate the code of this PR into the
production implementation)

The JSON levers are meant to indicate that "anyone" can pick the
appropriate/available levers and configure how they are set.  In other
words, these values do not create SQL injection issues.

**What I Need from You**

I am putting this forward as a draft so you can read this code ahead of
time.  I'm then going to schedule a synchronous code review where we
record our collective walk through of the implementation.

Closes:

- forem/forem#17268
- forem/forem#17269
- forem/forem#17270
- forem/forem#17271
- forem/forem#17273

Relates to:

- forem/forem#17308
- forem/forem#17245

[1]:6818ef3ed0/app/services/articles/feeds/weighted_query_strategy.rb (L84-L231)
[2]:https://forem.team/jeremy/refinements-to-our-present-feed-configuration-1p0c
2022-04-19 16:51:18 -04:00
Jeremy Friesen
e3215a81ba
Adding fw-heavy to spaces H1 (#17351)
From Anuj:

> Going forward we will be using heavy font-weight for the titles of all
> the admin sections. So it’s good consistency-wise.

This resolves that issue.

Closes forem/forem#17327
2022-04-19 15:44:24 -04:00
Jeremy Friesen
3225781ebf
Removing unclosed div tag (#17345)
This div tag is subsumed by the line below (e.g. `<%=
application_policy_content_tag("div"...`).  When the unclosed div is
present there is some undesirable layout offset.  When it's removed,
things line up a bit nicer.

Discovered while attempting to reproduce forem/forem#17324
2022-04-19 14:06:25 -04:00
Takuya N
04150f1024
Update jQuery from 3.3.1 to 3.6.0 on /videos/new (#17205)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-19 11:00:30 -04:00
Jeremy Friesen
aebde42730
Adjusting feed query to establish a new incumbent (#17308)
This commit modifies two things:

1.  The sort order of the feed.
2.  Locking in the next incumbent for the feed.

In consultation with Jamie regarding the SQL, I've switched from a WHERE
IN type clause to creating a JOIN.  This allows for the calculated
relevancy score to become a sortable value for the feed.

Second the incumbent feed is a slight modification of the past winner;
based on the results of a long running experiment.  This adjustment is
per conversations with product.

The past experiment ran since early February, so it's time to retire it,
regroup and move forward.

Closes forem/forem#17307
2022-04-19 09:10:00 -04:00
Suzanne Aitchison
b4b7d4bd39
Admin member index: invitations responsive layout (#17278)
* add expandable search control at mobile size

* add invitations smaller layout

* replace missing member image

* tweaks following merge

* minor layout tweaks

* add actions to smaller view, update cypress specs
2022-04-19 10:00:15 +01:00
Takuya N
3eee116104
Enable error tracking on sendFollowUser (#17328)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-18 22:13:31 -04:00
Takuya N
c36ba7b6de
Avoid redirection by replacing with newer URL (#17320)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-18 22:12:21 -04:00
Takuya N
1c9bc2d1ef
Replace links to the repo with newer URLs (#17319)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-18 22:11:31 -04:00
Anna Buianova
05d0464a78
Context Notifications (#17243)
* ContextNotification model

* Create and destroy context notifications when notifications are sent/unsent

* Added a transaction when creating notifications and context notifications

* Documentation for context notifications
2022-04-18 10:30:30 +03:00
Monica Mateiu
6818ef3ed0
Remove references to article.spaminess_rating (#17235)
* Remove references to article.spaminess

* Update app/models/article.rb

* Update spec/workers/comments/calculate_score_worker_spec.rb

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* remove unnecessary BlackBox spec

* Update spec/workers/comments/calculate_score_worker_spec.rb

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

* Remove references to calculate_spaminess

* Update app/workers/comments/calculate_score_worker.rb

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
2022-04-15 11:43:48 -04:00
Jamie Gaskins
16c49a5df2
Escape user-supplied regex terms (#17305) 2022-04-15 10:18:16 -04:00
Takuya N
63c3229e36
Remove use of jQuery on admin config JS (#17206)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-15 07:13:00 -06:00
Suzanne Aitchison
e2232cd975
Admin member index: style the GDPR requests table (#17287)
* basic table styles added

* small layout

* Change done to deleted
2022-04-15 14:04:18 +01:00
Jeremy Friesen
3a37db7b30
Ensuring /new remains a call to action end point for DEV (#17294)
There are two problems engrained in this:

1. The undocumented expectation of `/new` needed to other sites linking
with prefill information.
2. The prefill parameters being lost during the authentication process.

The first bug was introduced as part forem/forem#16536.  The second is
likely introduced as part of a Rails upgrade (namely `request.path` most
likely once included the query parameters but with our current
implementation it does not).

Closes forem/forem#17292
2022-04-14 14:50:40 -04:00
Jeremy Friesen
f8590a6d84
Correcting public_reactions_count (#17280)
Prior to this commit, we were looking at trusted user's reaction
counts.  This is not the desired column to be testing.

See
f1d6291d00/app/models/reaction.rb (L25-L28)

```ruby
  counter_culture :reactable,
                  column_name: proc { |model|
                    PUBLIC_CATEGORIES.include?(model.category) ? "public_reactions_count" : "reactions_count"
                  }
```

In the above code, all public reactions (hearts, unicorns, reading
list) go to public_reactions_count.  Other things go to the
`reactions_count`; which is the thumbs up and thumbs down.

Fixes forem/forem#17260
2022-04-14 13:31:07 -04:00
Ridhwana
2746e77fd5
Adding a modal for the CSV export (#17259) 2022-04-14 18:19:28 +02:00
Arit Amana
b08de775e5
implementation (#17286) 2022-04-14 10:26:48 -04:00
Julianna Tetreault
317b066853
Hide Role Badges from the Member Index View (for the time being!) (#17282)
* Comments out role bages in the Member Index View for the time being

* Further comments out #cascading_high_level_user_roles
2022-04-14 07:18:38 -06:00
Julien Maury
01c1d44e65
Fix duplicate IDs on homepage (#17092)
* fix duplicate ID main nav

* fix duplicate ID other nav headings

* fix duplicate ID reading list count

* fix duplicate attribute class

* missing case readingCountList on feed

* missing dot in query selector

* Revert "fix duplicate ID other nav headings"

This reverts commit 4f495962c47e08f0f6c41e33e897b2db176432f5.

* use generic class 'other-nav' for tests

* pass a variable 'context' to the partial nav

* pass var 'context' to partial

* fix unwanted typo in partial sidebar

* Update app/views/admin/navigation_links/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/assets/javascripts/initializers/initializeReadingListIcons.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/assets/javascripts/initializers/initializeReadingListIcons.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* js-reading-list-count renaming

* use data-testid instead of generic classes for tests

* fix typo in specs

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-14 10:48:55 +01:00
ludwiczakpawel
3a753cd7f6
one checkbox (#17212) 2022-04-14 10:51:40 +02:00
Suzanne Aitchison
a0a4b8a851
Member index (Phase 2) - Invitations actions (#17213)
* Add actions to invitations table

* table style tweaks

* add specs for cancel and resend actions

* rspec resend test
2022-04-14 08:26:36 +01:00
Suzanne Aitchison
3829e836a2
Admin member index - minor UI/a11y fixes (#17246)
* apply some missing classes

* sweep up minor UI and a11y issues

* add missing context locals in invitations view
2022-04-14 07:59:31 +01:00
Mac Siri
441a76972b
Refactor: Move onboarding routes out of UsersController (#17189) 2022-04-13 14:20:16 -04:00
dependabot[bot]
3f3b13f382
Bump @testing-library/user-event from 13.5.0 to 14.1.0 (#17253)
* Bump @testing-library/user-event from 13.5.0 to 14.1.0

Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.5.0 to 14.1.0.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.5.0...v14.1)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* refactor to account for breaking changes

* remove redundant cleanup

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-13 10:41:08 -06:00
Suzanne Aitchison
64ed2c6dec
move showModal helper into its own pack file (#17266) 2022-04-13 14:15:07 +01:00
Ridhwana
44c9535d06
chore: typo (#17258) 2022-04-12 22:14:59 +02:00
Julianna Tetreault
760a51f5f7
Refactor Member Index View Users Query (#17251)
* Moves eager loading from _member_index view to Admin::UsersController

* Adds .registered to Admin::UsersQuery
2022-04-12 11:20:28 -06:00
Julianna Tetreault
471472d0b0
Add Internationalization to Admin::UsersController Success Messages (#17252)
* Adds internationalization to Admin::UsersController success messages

* Adds a new line at the end of en.yml and fr.yml

* Removes perriod from update_success message
2022-04-12 09:00:55 -06:00
Ridhwana
aff29406ac
First version of exporting the Users to a CSV (#17217)
* feat: add the export route

* feat: base export csv

* refactor: move the svg into its own file

* feat: add the export partial

* feat: export teh correct fields etc. for the csv

* user status helper

* feat: ensure that we format the time

* feat: add a spec for the CSV

* remove space

* remove puts

* chore: remove blank space

* feat: update traits

* Update app/views/admin/users/export.csv.erb

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

* Update spec/requests/admin/users/users_export_spec.rb

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

* Update spec/requests/admin/users/users_export_spec.rb

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

* fix: export should not error for unregistered users

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
2022-04-12 15:24:32 +02:00
Suzanne Aitchison
b1e7d8a5ec
Member index (phase 2) - Search invitations (#17210)
* add ability to search invitations

* add an invited scope

* add a cypress test
2022-04-12 10:40:44 +01:00
Takuya N
038d355422
Tweak z-index for buttons in liquid tags (#17196)
* Tweak z-index for buttons in liquid tags

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>

* Tweak z-index for buttons in liquid tags more simply

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-12 09:48:27 +02:00
Jeremy Friesen
61ccc29fed
Conditionally disabling Listings (Waiting on Product but technically Good to Go) (#16437)
* 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.

Closes forem/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
2022-04-11 20:23:56 -04:00
Suzanne Aitchison
c8b5282337
Admin member index: invitations table (#17180)
* basic table cols

* more detailed member col, overflow menu

* bottom pagination

* replace with partial
2022-04-11 19:36:55 +01:00
Suzanne Aitchison
a44d09e71a
Update table style for member index view (#17207)
* add minimal table style

* tweak table style vs member index specific style

* rename

* replace padding for smaller screens
2022-04-11 19:07:59 +01:00
Jeremy Friesen
e2618c50f5
Adding logic to hide Create Post on empty dashboard (#17149)
* Adding logic to hide Create Post on empty dashboard

As implemented, folks won't see this page if they can't create a post.
However, as our implementation drifts, we should continue to apply the
same policy.

See forem/forem#16999 for the conditional logic that redirects users.

* Adding a hack to fix a unit test
2022-04-11 13:52:35 -04:00
Julianna Tetreault
f6d7d431b5
Updates the role tooltip within _member_data.html.erb (#17218) 2022-04-11 11:50:55 -06:00
Jeremy Friesen
f790c3c0c1
Encapsulating the "why we hide/show" something (#17166)
* Encapsulating the "why we hide/show" something

Prior to this commit, we were relying on our views/templates to
understand why it might want to append the "hidden" dom class.  That is
not ideal, because it required repeating knowledge about the conditions
of the policy outside of the policy's domain.

With this commit, we're removing a duplication of knowledge; or more
appropriately asking the steward responsible for the knowledge to
produce the answer.

* Refining the note to not describe a course of action
2022-04-11 13:40:16 -04:00
Jeremy Friesen
02ff835e7f
Conditionally removing listing reference (#17211)
* Conditionally removing listing reference

Prior to this commit, our notifications would send listing related information.

* Update app/views/mailers/notify_mailer/new_badge_email.html.erb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2022-04-11 13:02:17 -04:00
Takuya N
3edffcbb22
Replace #to_s(:format) with #to_fs (#17219)
https://github.com/rails/rails/pull/43772
https://github.com/rails/rails/pull/44354

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-11 12:59:54 -04:00
Julianna Tetreault
bf67ae2fbb
Refactor Member Index View Tooltips (#17170)
* Adjusts Member Index View tooltips to include resource type

* Adds .compact to the list of resource_types in #format_role_tooltip

* Updates users_helper.rb#format_role_tooltip tests

* right align tooltip

* Update app/views/admin/users/_member_index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-11 09:20:26 -06:00
Takuya N
8bed053f85
Remove unused articles/_splash.html.erb (#17198)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-11 08:26:05 -06:00
Takuya N
b5ea75cf39
Use correct trademarks in supported embeds (#17195)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-11 07:32:45 -06:00
ludwiczakpawel
cc6679f194
box sizing (#17185) 2022-04-11 12:16:58 +02:00
Miguel Nieto A
13c433cd56
fix: 🐛 Fix Color displaying over button in settings (#17172) 2022-04-11 10:59:57 +02:00
ludwiczakpawel
d6f204afc1
Toggle component (#17126)
* toggle

* box-sizing

* fixes

* whoopsy

* add specs for toggle component

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-11 09:44:43 +02:00
Jeremy Friesen
168698fe28
Conditionally removing listing from Admin > Consumer Apps menu (#17182)
Related to forem/forem#16437
2022-04-08 21:55:45 -04:00
Daniel Uber
7f1fdc7324
Produce a meaningful slug from podcast episode title (#17184)
* Use sluggerize to produce a slug from podcast episode title

This is essentially the process we use for Article#title_to_slug
without the random trailing bits on the end (since podcast episodes
had not worked that way previously).

* Add test case for slug generation

* Oh, the test only works if you checkin the fixture, too
2022-04-08 16:30:16 -05:00
Daniel Uber
2ddefcbba5
Remove guard clauses and update expectations (#17138) 2022-04-08 15:20:19 -05:00
Suzanne Aitchison
dcb46e088b
bring repeating layout code to partials (#17179) 2022-04-08 17:52:18 +01:00