Commit graph

1288 commits

Author SHA1 Message Date
Fernando Valverde
21103696c3
Add missing explicit scopes to Omniauth adapters (#17761)
* Add missing scopes to Omniauth adapters - explicit > implicit

* Trigger CI
2022-05-25 09:56:13 -06:00
Dwight Scott
f19fa13215
new feed variant 20220518 (#17722)
* new feed variant 20220518

* source code in favor of the spreadsheet

* remove following_org and follow_author in favor of query performance
2022-05-18 18:09:05 -04:00
dependabot[bot]
17955537e7
Bump ddtrace from 0.54.2 to 1.0.0 (#17662)
* Bump ddtrace from 0.54.2 to 1.0.0

Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.54.2 to 1.0.0.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v0.54.2...v1.0.0)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Apply configurationa update

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-05-18 15:46:49 -04:00
yheuhtozr
aa7e5d45fc
i18n keys update for new profile decorator (#17684) 2022-05-18 10:51:06 -04:00
Jeremy Friesen
127e3ac248
Adding page view goal for experiments (#17696)
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#17669
Closes forem/forem#17691
2022-05-16 15:07:42 -04:00
Jeremy Friesen
8a4e1ebeba
Adding more goals to feed experiments (#17673)
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.

Closes forem/forem#17669
2022-05-13 13:22:06 -04:00
Mac Siri
215bf4abe6
Update datadog.rb to include env scope (#17667) 2022-05-12 18:13:20 -04:00
Mac Siri
fc188a0759
Simplify ddtrace configuration (#17665) 2022-05-12 15:19:47 -04:00
Mac Siri
8d39d22d9e
Revert "Bump ddtrace from 0.54.2 to 1.0.0 (#17560)" (#17643)
This reverts commit eeed96cf9c.
2022-05-12 09:28:50 -04:00
yheuhtozr
d6c15a3fc6
I18nize Constants::Settings (#17086)
* app/lib i18n (no callers)

* tidy key names

* callers deconstantified

* delete ja.yml

* update locale keys and calls

* remove ja.yml

* Revert "remove ja.yml"

This reverts commit 6a6881e274b58424ece0411c887c862124a2ca87.

* fix conflicts

* remove ja.yml

* Update general.rb
2022-05-11 09:58:37 +01:00
Jeremy Friesen
27b82996ce
Adding new relevancy lever for privileged reactions (#17598)
* 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
```

Closes forem/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>
2022-05-09 11:32:57 -04:00
Jeremy Friesen
66119985b6
Adding a field test option for post publishing goals (#17589)
* 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.

Closes forem/forem#17585

* Fixing broken test
2022-05-06 13:54:50 -04:00
Jeremy Friesen
38ee9ef309
Refactoring so relevancy levers define expected variables (#17591)
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.
2022-05-06 13:54:33 -04:00
dependabot[bot]
eeed96cf9c
Bump ddtrace from 0.54.2 to 1.0.0 (#17560)
* Bump ddtrace from 0.54.2 to 1.0.0

Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.54.2 to 1.0.0.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v0.54.2...v1.0.0)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Update config file for 1.0:

* Use Tracer class for 1.0

* Re-enable priority sampling

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Puetz <hi@joshpuetz.com>
2022-05-05 06:57:43 -06:00
Ridhwana
6f880ee5b6
Update the Sidebar to include the Member Manager (#17538)
* feat: update all the paths as a first order of business

* feat: update all the folders to no longer appear under users

* feat: update specs

* feat: update specs

* feat: remove User namespace

* feat: remove route namespace

* feat: path change

* feat: move the menu items to the sidebar

* feat: add a badge

* feat: remove tabs partial

* xs font

* feat: update describe blocks

* feat: update cypress tests

* chore: oops member_manager instead of member_management

* feat: c-indicator

* feat: update the tests

* feat: update the gdpr test

* feat: add the invitations

* chore: align

* feat: update the GDPR constant

* feat: rename to GDPR actions

* feat: add member manager route
2022-05-05 12:46:47 +02:00
Suzanne Aitchison
50d2359049
add crayons modal to gdpr confirm delete flow (#17568) 2022-05-05 08:19:34 +01:00
Ridhwana
e72957a913
feat: add an inflection and change instances of gdpr to GDPR (#17567) 2022-05-04 16:20:46 +02:00
Jeremy Friesen
fe2e53cc50
Moving Experiments into AbExperiment namespace (#17532)
* 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 closes forem/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".

Closes forem/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>
2022-05-03 21:34:12 -04:00
Ridhwana
3fc6108651
Remove GDPR from the "users" namespace (#17536)
* feat: update all the paths as a first order of business

* feat: update all the folders to no longer appear under users

* feat: update specs

* feat: update specs

* feat: remove User namespace

* feat: remove route namespace

* feat: path change

* feat: update url
2022-05-03 19:42:20 +02:00
Suzanne Aitchison
25bf8a0711
Remove name from invitation flow (#17438)
* remove name from invite user flow

* remove name from invitation instructions

* update invitations spec

* update specs and invitation actions overflow menu name

* allow users to set name when accepting invite
2022-05-03 09:33:12 +01:00
Fernando Valverde
c4df397fef
Community Wellness badge (#17394)
* 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>
2022-04-29 12:38:40 -06:00
Daniel Uber
d571231ea4
Remove sustaining member newsletter, and its settings (#17514)
* Remove sustaining member newsletter, and its settings

This removes the concept of sustaining memberships from the system,
and logic related to or dependent on it.

This does not remove the monthly_dues column from the users table (todo).

* Remove unused newsletter setting

Since nothing accesses the mailchimp_sustaining_members_id setting,
it's safe to remove.

* Use destroy rather than delete to ensure settings cache is cleared

We have a callback in Settings::Base to clear the cache after commit,
I assume it's useful to trigger that. This requires destroy, not
delete, to be called.
2022-04-29 11:47:12 -05:00
Jeremy Friesen
7e62d8098f
Removing conditional for AdminMenu's spaces (#17162)
When we merge this, Forem admins will see the "Admin > Content Manager >
Spaces" section in their Admin area.  This will then allow them to
toggle on and off spaces.

Closes forem/forem#17161
2022-04-28 08:49:59 -04:00
Mac Siri
4b37f2384c
Refactor OnboardingsController (#17329)
* Refactor OnboardingsController

* Fix broken spec

* Update policy

* Fix spec

* Update config/routes.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Touchup

* Update routes

* Screw it, let's move notification_settings too

* Revert "Screw it, let's move notification_settings too"

This reverts commit aead8c05f4dda62cbc46cdd033afd0acdef2ad73.

* Temp .travis.yml changes

* Revert "Temp .travis.yml changes"

This reverts commit c26109843ba027f9a524e66282a9b01f0341f836.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-04-27 16:17:02 -04:00
Mahmoud Harmouch
e4af0ad549
Fixed a grammatical error. (#17413)
* Fixed a grammatical error.

Signed-off-by: Harmouch101 <eng.mahmoudharmouch@gmail.com>

* Updated a test case.

Signed-off-by: Harmouch101 <eng.mahmoudharmouch@gmail.com>
2022-04-27 08:24:57 -06:00
yheuhtozr
ef290a5120
controllers/admin i18n (#17085)
* admin controllers i18n

* remove ja.yml

* fix for spec

* fix for spec 2

* Apply suggestions from code review

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

* Update config/locales/controllers/admin/fr.yml

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

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-04-26 09:40:09 -06:00
Andy Zhao
0fca6a6f35
Permanently delete users from Mailchimp automatically (#17395)
* Rename unsubscribe to remove_from_mailchimp_newsletters

* Permanently delete from mailchimp instead of unsubscribing

* Rename method and remove comment

* Don't use i18n because of error message

We don't want to use i18n here because e.title comes from the error response. If a Forem
was using a different locale and Mailchimp for newsletters, they would still receive the
error response in English (because of Mailchimp).

* Refactor and rename a bit

* Rename methods in tests accordingly

* Remove now moot test

* Rename method in other places it was previously called

* Remove unused translation, see 62fee247ee2565e4d3d14919a8636a76ce5ecc9f

* Fix typo and report error if not 404
2022-04-26 09:48:50 -04:00
Mac Siri
8d45c7377c
Create new feed-variant 20220422 (#17406) 2022-04-25 09:55:33 -04:00
Jeremy Friesen
0d0464be2f
Allowing VariantQuery for Feed Generation (#17382)
* Allowing VariantQuery for Feed Generation

Apologies for the breadth of this pull request, I had considered many
small commits, but felt that would've been more effort for the value
provided.

This commit includes the following:

- Documentation updates to the feed variant (though not the final pass)
- Renaming and adding RelevancyLevers that help differentiate
- Adding RelevancyLever#range to provide documentation
- Reducing redundent controller logic by making a
  `Articles::Feeds.feed_for` method.
- Adding some configuration validation for RelevancyLevers
- Adding constants for better clarification
- Testing unhappy paths for feed configuration
- Adjusting the module namespace of some objects
- Exposing top-level configurations for variants (along with their
  defaults)
- Creating the VariantyQuery that at present inherits from the
  `Articles::Feeds::WeightedQueryStrategy`

As implemented, we can deploy this code to production without using the
new VariantQuery.  Once we toggle on the
`:feed_uses_variant_query_feature` FeatureFlag, it will switch to using
the VariantQuery.  The VariantQuery's two variants and the
internal configuration of `Articles::Feeds::WeightedQueryStrategy`
produce the same query.

The goal of this factor is to allow for a quick on and off toggle of the
feed query; to ensure that what we introduce remains performant.

- Closes forem/forem#17272
- Closes forem/forem#17276
- Closes forem/forem#17216

In addition, I will be recording a code-walkthrough and linking that
recording to the pull request.

* Apply suggestions from code review

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-04-21 11:07:09 -04:00
Daniel Uber
4d33486e14
Enable string uuid as namespace (#17309)
* Enable string uuid as namespace

This addresses a noisy deprecation warning showing in specs (it points
to our re-implementation of warden's sign_in_as helper, but I suspect
the issue is within warden since our initializer seems to match the
implementation in the upstream gem).

My understanding of this is that the prior default had been to pass
the provided uuid namespace as-is if it didn't match one of a few
named constants. New behavior is to validate that any string provided
as a namespace looks like a uuid representation or fail).

* Move configuration change to framework defaults
2022-04-20 10:24:25 -05:00
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
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
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
Mac Siri
441a76972b
Refactor: Move onboarding routes out of UsersController (#17189) 2022-04-13 14:20:16 -04:00
Jeremy Friesen
f1d6291d00
Adding Feed Configuration documentation (#17248)
* Adding Feed Configuration documentation

This documentation outlines the scope and intention of the Feed
Configuration, it's primary purpose is to:

- Reference the historical context
- Establish a draft glossary
- Introduce high-level constraints
- Serve as a document to help with the task break-down

Closes forem/forem#17244
Relates to forem/forem#17245
Informs forem/forem-internal-eng#435

As a note, I'm looking at this document almost through the lens of
[literate programming][1].  In writing the document, I learned about and
attempted to describe the shape of this internal facing project.

Consider for a moment that we are not adding a new user facing feature
to the Forem code base.  Instead we're scoping this project as helping
ease the experimentation process regarding the feed.

In other words the scope of this project is to help name and refine
different feed strategies to understand what each strategy means.

Eventually this could mean that creators and members can have a
future opportunity to select feed strategies that reflect the
aspirational community values of the feed (e.g. we want a feed that
favors comments, or neighborhoods, or the occassional serendipity).

[1]:https://en.wikipedia.org/wiki/Literate_programming

* Update config/feed/README.md

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

* Update config/feed/README.md

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

* Update config/feed/README.md

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

* Update README.md

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-13 13:04:25 -04:00
Arit Amana
240893401d
Show a "Unable to login" message in browser when a user is unable to login. (#17261)
* implementation and modify spec

* oops! correct unwanted change

* nudge Travis

* nudge Travis
2022-04-13 09:00:56 -04: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
Daniel Uber
2ddefcbba5
Remove guard clauses and update expectations (#17138) 2022-04-08 15:20:19 -05:00
Arit Amana
e4446a778c
Revalidate embedded links that redirect (#17150)
* complete implementation and add specs

* delete irrelevant spec and comment

* refactor validate_link method to return passed-in url

* better naming

* handle NotAllowed status in link validation
2022-04-07 13:32:07 -04:00
Jeremy Friesen
07983e38be
Adjusting conditional create post rendering (#17132)
* Revert "conditionally render create post button for admins #16490 (#16606)"

This reverts commit 1cb45995cb.

* Adding conditional create post rendering

This pull request does two things:

- Reverts the forem/forem#16606
- Replaces the conditional rendering with the approach from forem/forem#17076

What to consider:

- How does this impact Cumulative Layout Shift (CLS).  Prior to this
  commit, we didn't "flicker" the "Create Post" button into view if the
  site didn't have the conditional.
- In reverting forem/forem#16606 we remove a dependency on Turbo.
- We reduce one network call, relying instead on the async_info to carry
  the visible/hidden logic.

If the "flicker" is a problem we could add a conditional in the page for
if the site has enabled that feature.  However, that's a place holder as
we're looking at possible other reasons for allowing/disabling the
create a post.

This is a non-blocking PR, as in we can merge or not merge this and
proceed with what we have.  Instead the main goal is to "unify" our approach.

* Update cypress/integration/seededFlows/policyFlows/limitPostCreationToAdmins.spec.js

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

* Leveraging change from forem/forem#17143

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-07 09:11:37 -04:00
Arit Amana
5cf2229b58
Better Error Msg when Listing URL embedded and Listings are disabled (#17116)
* complete implementations and specs

* remove unused error msgs

* add "listing" and "listings" as ReservedWords
2022-04-06 08:38:53 -04:00
Jeremy Friesen
d181041ae2
Removing uncalled method ✂✂✂ (#17110)
Introduced in forem/forem#3176, it appears that this method has been
along for the ride.

How did I find this?  I saw an exception and realized that we cast our
comment IDs from base-26 integer format to base-10.  I decided to look
through our code for `/\.to_\w\(26\)/` and stumbled upon the now removed
instance.

Quickly looking at the code, it appeared that this method was never
called.

So ✂✂✂
2022-04-04 16:05:53 -04:00
Dwight Scott
71294dca14
OpenGraph fallback for Embeds (merge-by-any-core) (#17001)
* WIP -- start of OpenGraph class that wraps MetaInspector gem

* use properties method instead of hash

* Update app/services/open_graph.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/open_graph.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/open_graph.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/open_graph.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/open_graph.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/open_graph.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* address PR feedback

* adding some specs

* gem vendor cache

* more specs

* lock metainspector gem to 5.11

* Update app/services/open_graph.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* WIP -- start of incorporating the open graph into the view

* regex match anything

* Update app/liquid_tags/open_graph_tag.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Refactors and Improvements

* build UI (some wonkiness; see loom)

* UI improvements

* add hyperlink to embed url

* display site_name conditionally

* Make PR review changes; implement A-tag fallback for OG

* Address PR review comments

* Fix failing spec

* deleted superfluous assignment; switched filename annotations off

* nudge Travis

* Address PR feedback

* attempting to apply custom styles

* update specs

* update specs

* add favicon if exists

* remove site-name method

* styling changes 

* nudge Travis

* PR review comments

* keep border around A-tag fallback

* use preferred description

* remove www prefix from url

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Arit Amana <msarit@gmail.com>
2022-04-04 15:31:38 -04:00
Jeremy Friesen
1b2aa68a4d
Ensuring confirmation and flash message for spaces (#17072)
* Ensuring confirmation and flash message for spaces

This change delivers an accessible form, and while it doesn't remove the
Save button nor produce a modal it does deliver the minimum viable
functionality.

In conversations with Suzanne, we spent an hour looking at how we might
make an accessible modal with the checkbox and state management
required as we as removing save buttons.

There are two paths:

1. Extend the current, yet deprecated, stimulus modal controller.
2. Extend the Preact modal work done for the Members Detail View.

We spent about 15 minutes pursuing the stimulus modal controller route,
and realized how much cruft it added to the system.  Not ideal and very
opaque in it's interaction.

The second one we talked about, but for our alloted time was inadequate
to begin further work.  To deliver on that generalized preact modal will
require at least an afternoon of work.

Closes forem/forem#17032

* Update config/locales/controllers/admin/fr.yml

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

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

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

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2022-04-04 11:49:15 -04:00
Jeremy Friesen
2fda726409
Revert "Added a way to sort comments on an article (#16686)" (#17093)
This reverts commit 1345334b33.
2022-04-04 08:36:34 -04:00
Ben Halpern
9f44530491
Add "comments_sort" to safe params list (#17083) 2022-04-01 18:27:49 -04:00
Ben Halpern
050976af25
Add "period" to safe params list (#17079) 2022-04-01 14:18:07 -04:00
VISHAL DEEPAK
1345334b33
Added a way to sort comments on an article (#16686)
* Added a way to sort comments on an article

* Sorting of comments now uses crayons-dropwn. Some minor fixes as per comments on PR

* Add and fix test cases for sorting comments functionality

* Changes in code for sort comments.  Code  is more aligned with forem's conventions

* Added cyperss tests for sort comments on an article. Cleaned up code to better follow forem conventions

* Get fresh handle of triggerButton everytime clickOustideListener is clicked. Fix Cypress test cases to reflect the earlier.
2022-04-01 09:26:18 -05:00
Michael Kohl
33195929aa
Bump to Rails 7.0.2.2 MVP (#15908)
* Update gems

* Update more gems

* Update @rails/ujs package

* Explicitly add sprockets-rails

* Gemfile update

* Run bin/rails app:setup

* Update redis-actionpack

* Update stats initializer autoloading

* Update acts-as-taggable-on

* Disable signed: true option in session store

* Switch back to released version of redis-actionpack

* Update Gemfile.lock

* WIP

* Update Rails and gems

* Move hair_trigger back to released gem

* Add explicit requires to initializers

* Update Rails version

* Add more explicit require_relative calls

* Re-enable ForemStatsDriver

* Update schema

* Temp spec changes

* Bullet started raising errors?

* Fix broken spec

* Temporarily disable hair_trigger_spec

* Refactor

* Fix spec

* Enable use_rfc4122_namespaced_uuids

* Revert "Enable use_rfc4122_namespaced_uuids"

This reverts commit 5dac3722284bb08049586bfa943405f8a01289df.

* Temporarily deploy to canary

* Revert "Temporarily deploy to canary"

This reverts commit 04f8469501fab2a3177450baf051ff6259c41827.

* Update Containerfile

* Add comments to specs

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-03-30 15:00:33 -04:00