Commit graph

10794 commits

Author SHA1 Message Date
ludwiczakpawel
df34cbbd7e
Admin layout update (#16345)
* .

* Brand colors

* Update app/views/layouts/admin.html.erb

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* another label change

* Update app/views/layouts/admin.html.erb

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

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-01-31 11:53:46 +01:00
Ben Halpern
96a935ffec
Add new cases for reaction weights to lead to more effective rankings (#16138)
* Base author reaction functionality

* Get logic more in place

* Finalize tests

* Add admin clause for new user points

* Add proper registered_at for seeded user

* Fix regsitered_at in e2e

* Add registered_at across the board in e2e tests

* Update comments

* Update spec/models/reaction_spec.rb

Co-authored-by: Jamie Gaskins <jamie@forem.com>

* Update spec/models/reaction_spec.rb

Co-authored-by: Jamie Gaskins <jamie@forem.com>

* Update spec/models/reaction_spec.rb

Co-authored-by: Jamie Gaskins <jamie@forem.com>

* Put points in constant and refactor points resave logic

Co-authored-by: Jamie Gaskins <jamie@forem.com>
2022-01-28 12:28:18 -05:00
Anna Buianova
6a69d9bc61
Set config.cache_classes for test env depending on whether Spring is enabled (#16344)
* Set config.cache_classes for test env depending on whether Spring is enabled

* Explain setting config.cache_classes in the test env
2022-01-28 19:19:19 +03:00
Julianna Tetreault
5afcdb3f71
Add admin_member_view Feature Flag (#16346)
* Adds an admin_member_view feature flag and spec

* Adds the admin_member_view FeatureFlag to seeds_e2e for testing
2022-01-28 09:13:35 -07:00
Jeremy Friesen
6fb7361552
Extracting listing routes (#16338)
The fundamental goal in this refactor is to make it easier to disable the
Listings feature set.  By extracting a routes file (via the `draw` method [see
implementation details][1]), we can more easily disable those routes _en
masse_.  This "crease in the code" could mean that we wouldn't need to update
the controller action logic.  An update of that logic might mean going into
each controller action related to listing and adding a conditional for render
404 when listing is disabled.

Now, on to why this should work (not I did not open the application and click
around, but instead went with a "let the framework help me" mindset).

I believe that this should work; though there's a caveat†.  Here's why I
believe this will work for extracting the listing routes:

Before making changes I ran the following:

```sh
$ rails routes | sort > original-routes.txt
```

Let's break that down:

- `rails routes` :: renders the routing table for Rails; this is how
  Rails converts routes to the magic of stuff like `article_path(:id)`
- `| sort` :: to sort the results
- `> original-routes.txt` :: to write the results into a file.

Then I made the changes and ran the following:

```sh
$ rails routes | sort > updated-listing-routes.txt
```

And finally, I ran:

```sh
$ diff updated-routes.txt original-routes.txt
```

The results were as follows:

```sh
500c500
<                     api_organization_listings GET      (/locale/:locale)/api/organizations/:organization_username/listings(.:format)          api/v0/organizations#listings {:locale=>nil, :format=>"json", :to=>"organizations#listings"}
---
>                     api_organization_listings GET      (/locale/:locale)/api/organizations/:organization_username/listings(.:format)          api/v0/organizations#listings {:locale=>nil, :format=>"json"}
```

Note the only difference is that the above two lines, one has
`:to=>"organizations#listings"` and the other does not.  However, the
`./spec/requests/api/v0/organizations_spec.rb` exercises the route; so I
assume a hiccup/foible in the route reporting.

There was no difference between the before and after files.

† Caveat: if for some reason the order of the routes mattered, this will
have messed that up.  I don't think that is the case, but we shall see.

Related to forem/rfcs#291 and #16335
2022-01-28 10:49:52 -05:00
Jeremy Friesen
77d9640e3e
Initial statement of intent regarding Listings (#16335)
* Initial statement of intent regarding Listings

I want to use this pull request as a means of conveying intended
direction; namely that we want Forem administrators to be able to toggle
off (or on) the Listing feature set.

This refactor is a first, yet incomplete pass, that doesn't make the
code worse.  Expect more of a similar vein as we work to put the Listing
feature set behind a feature flag.

Related https://github.com/forem/rfcs/issues/291

* Adding feature flag based on reviewer comment
2022-01-28 10:07:06 -05:00
Dwight Scott
077ce36fb4
Added search feature to tags index to search all tags (#16292) 2022-01-28 08:00:11 -05:00
ludwiczakpawel
1abf02d94b
Generator updates (#16339)
* generator

* mod tools update
2022-01-28 12:20:30 +01:00
Michael Kohl
914b984e9b
Use perform_bulk in Podcasts::EnqueueGetEpisodesWorker (#16325) 2022-01-28 11:32:25 +07:00
Michael Kohl
30d2ec6220
Use peform_bulk in Podcasts::Feed (#16324) 2022-01-28 10:16:07 +07:00
Michael Kohl
0d2e05857d
Use peform_bulk in Article#before_destroy_actions (#16326) 2022-01-28 10:09:51 +07:00
Julianna Tetreault
48c1942e76
Removes redundant Verify Email Ownership button (#16340) 2022-01-27 16:11:29 -07:00
Daniel Uber
9f79c92563
Cap tag point sum to 10 (#16342)
* Cap tag point sum to 10

We only have 0..9 configured for cases to consider, treat all "large"
numbers as 10, since it will follow the same path in the weighting.

Use least(value, ...) to cap this. See https://www.postgresql.org/docs/11/functions-conditional.html#FUNCTIONS-GREATEST-LEAST

Fixes https://github.com/forem/forem/issues/16341

* UPCASE sql keywords to distinguish from column or table names
2022-01-27 16:22:49 -06:00
Jeremy Friesen
0484c550c5
Create/update by NavigationLink identity (#16312)
Prior to this commit, we were treating all NavigationLink attributes as
unique.  So, were we to change a position of one of the NavigationLinks
during the add_navigation_links rake task, we would have created a new
NavigationLink (and the only one would have remained).

With this commit, we're introducing the concept of the NavigationLink's
surrogate identity, that is to say if we have two NavigationLink objects
with the same `url` and `name` we should consider them the same
NavigationLink.  This allows us to update properties of those
NavigationLinks (via the rake task) without the risk of creating new
entries.

This unblocks PR #16268 which addresses #16076.
2022-01-27 13:51:41 -05:00
Ben Halpern
1ae10d7e6f
Remove hardcoded /badge page that is DEV-only ✂️✂️✂️ (#16303)
* Remove hardcoded /badge page that is DEV-only

* Remove /badge test

* Remove scheduled job
2022-01-27 13:29:05 -05:00
dependabot[bot]
e85aec1d11
Bump puma from 5.5.2 to 5.6.1 (#16330)
Bumps [puma](https://github.com/puma/puma) from 5.5.2 to 5.6.1.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v5.5.2...v5.6.1)

---
updated-dependencies:
- dependency-name: puma
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-27 09:48:30 -07:00
ludwiczakpawel
c9ef2ac15c
Modals fixes (#16310)
* .

* dark

* simplify and add stories

* update stories and docs

* fix
2022-01-27 16:24:23 +01:00
ludwiczakpawel
188877a865
Crayons: Pills component (#16271) 2022-01-27 15:34:03 +01:00
Jeremy Friesen
a83e87372c
Favor tag sort by count over hotness (#16322)
The hotness score is an "opaque to our users" score, it reflects
"activity" on the tag.  However, by also showing the number of tags on
the associated view, there's a bit of a head scratcher when a "hotter"
tag with less tags is rendered ahead of a popular tag.

Closes #16321
2022-01-27 07:19:05 -05:00
Jeremy Friesen
27123bce56
Adding possibly missing indices (#16323)
This is meant as a conversation.  Throughout the code-base we have have
`Tag.order(hotness_score: :desc)` and with PR #16322 we'll also have
`Tag.order(taggings_count: :desc)`.

My understanding is that if we have sorting, we might want to consider
an index.  I put this forward as a conversation with a possible quick win.

Related to #16322
2022-01-27 07:18:51 -05:00
Jeremy Friesen
fa8b55117d
Ensuring we fetch latest podcasts by pubDate (#16319)
* Ensuring we fetch latest podcasts by pubDate

Prior to this commit, we fetched the podcasts that were the first(:limit)
XML `item` nodes in the RSS feed.  Some folks might choose to list those
in descending pubDate order, while others list in ascending pubDate
order.

Closes #3580

* Bump for travis
2022-01-27 07:15:28 -05:00
Michael Kohl
60639bcb71
More ListingsToolkit refactoring (#16221) 2022-01-27 09:47:41 +07:00
Arit Amana
337657e53d
Implement Unified Embeds for Stackblitz URLs (#16313)
* building

* complete implementation and add specs

* handle params "?"

* changes

* optimization
2022-01-26 17:10:38 -05:00
Arit Amana
feebae6ae3
Implement Unified Embeds for Stackery URLs (#16320)
* complete implementation and add specs

* nudge Travis

* optimization
2022-01-26 16:19:27 -05:00
dependabot[bot]
355328cd4a
Bump rspec-rails from 5.0.2 to 5.1.0 (#16315)
Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 5.0.2 to 5.1.0.
- [Release notes](https://github.com/rspec/rspec-rails/releases)
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v5.0.2...v5.1.0)

---
updated-dependencies:
- dependency-name: rspec-rails
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-26 13:01:21 -07:00
dependabot[bot]
b8ee38a327
Bump hairtrigger from 0.2.24 to 0.2.25 (#16317)
Bumps [hairtrigger](https://github.com/jenseng/hair_trigger) from 0.2.24 to 0.2.25.
- [Release notes](https://github.com/jenseng/hair_trigger/releases)
- [Changelog](https://github.com/jenseng/hair_trigger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jenseng/hair_trigger/compare/v0.2.24...v0.2.25)

---
updated-dependencies:
- dependency-name: hairtrigger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-26 11:26:52 -07:00
Anna Buianova
3fdb87ee66
Added "Tags" category to search results (#16265)
* Added tag search to nav menu

* Added tag search

* Improved tags search results view

* Removed commented lines from the controller

* Fix specs for Search::Tag

* Prepare for tags search pagination

* Fixed Search::Tag specs

* styling

Co-authored-by: Paweł Ludwiczak <ludwiczakpawel@gmail.com>
2022-01-26 20:51:15 +03:00
Mac Siri
46fb59c944
Refactor FastImage usage (#16304) 2022-01-26 09:48:03 -05:00
ludwiczakpawel
122cae6bfe
Improve reset.css to cover all inputs (#16296)
* fix

* buttons too

* buttons too
2022-01-26 14:34:08 +01:00
ludwiczakpawel
99c05982e5
fix (#16307) 2022-01-26 12:34:14 +01:00
Michael Kohl
38f7957e3a
Clear app cache during bin/setup (#16267) 2022-01-26 13:10:36 +07:00
dependabot[bot]
9a76d32bcd
Bump counter_culture from 3.1.0 to 3.2.0 (#16302)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-26 09:15:56 +07:00
Michael Kohl
67f68b1cc2
POC: use Sidekiq.perform_bulk for Github repos (#16293) 2022-01-26 09:11:07 +07:00
Daniel Uber
4b4d8a7234
Ensure arguments to perform_async are json safe (#16285)
* Convert symbol hash keys to strings when calling .perform_async

Fixes a warning from Sidekiq 6.4.0+ about perform_async arguments
which are not equal when passed to perform (`JSON.parse(JSON.dump(arg))`
should equal arg).

This is a safety measure to prevent passing objects (like classes, or
model instances) rather than their representations (like a class name,
or a model's attributes hash).

This warning will be an error in sidekiq 7

* Turn warning into an error in non-production environments

* Use string keys for reaction notification and article fetched

Missed these two on the first pass

* Update example argument hashes for #enqueues_on_correct_queue

Since this calls perform_async under the hood we need to pass json
safe hashes in the test cases as well.

https://github.com/forem/forem/blob/main/spec/workers/shared_examples/enqueues_on_correct_queue.rb

* Convert keys from FollowData#to_h to string before perform_async

I'm not sure enough where else (outside of notification) to_h is being
called, so I'm converting here when building args, rather than in
FollowData#to_h, which might be my next step.

* Let FollowData#to_h return a hash with string keys

Update spec to use string keys as well.

* Make to_h return string keys for ReactionData

Like FollowData, the #to_h method is only used to call
notifications (this is used to enqueue sidekiq jobs).

* Remove a key that was in the hash

Since reaction_data calls to_h, it gets string and not symbol,
keys. Call Hash#except with a key that was actually there.
2022-01-25 18:07:40 -06:00
Ben Halpern
f393de4c21
Feed Experiment round 5: Factor in sum of tag points (#16272)
* Experiment with sum of tag points

* Cast sum of points to integer
2022-01-25 17:08:31 -05:00
Sabarish Rajamohan
922a9a9e10
Added title to be displayed for stackexchange question (#16289)
* Added title to be displayed for stackexchange question

* Fix for introduced spec

* Test Case Refactoring
2022-01-25 13:24:03 -06:00
Michael Kohl
31c805aa09
Let's be friends again, Rubocop (#16294) 2022-01-25 11:58:00 -05:00
Michael Kohl
a8813572c6
Request for Comments: Add Rubocop action (#16295)
* Add Rubocop action

* Update step name
2022-01-25 23:27:46 +07:00
Fernando Valverde
546c3b73bd
Android Runtime Banner - Chrome Intent support (#15181)
* Android - Chrome Intent

* Remove old inline comment

* Use regex for context check

* Update banner intent + playstore URL

* Use single constant for app launch scheme launch

* Use location.href instead of location.host

* Don't display banner on Firefox (Android)

* fix linter changes
2022-01-25 09:01:59 -06:00
Arit Amana
88d0823073
Implement Unified Embeds for Speakerdeck URLs (#16276)
* complete implementation and add specs

* nudge Travis
2022-01-25 07:21:39 -05:00
yheuhtozr
cae8ea2deb
i18n key updates in app/liquid_tags (#16275) 2022-01-25 11:03:09 +07:00
Jeremy Friesen
2b3f4e1342
Refactoring cached_followed_tags (#16175)
* Refactoring cached_followed_tags

This refactor consolidates two queries and a loop into a single query.

One thing that is unclear is if we're ever really clearing the cache of
the user by id?

What follows is un-related to the refactor but appears to be related to #14937.

> First, I see we set a cache here:
>
> ebdaaaf15b/app/decorators/user_decorator.rb (L23-L34)
>
> But when I look at what busts the user cache, it doesn’t look like we’re busting it for the above cached location:
>
> ebdaaaf15b/app/services/edge_cache/bust_user.rb (L3-L22)
>
> What if anything am I missing in regards to cache busting?

* Adding some deprecated methods

* Updating documentation

* Bump for travis

* Bump for travis

* Updating comments to fix confusion

NOTE: I might be introducing more confusion, but at least
I'm addressing the prior confusion.

* Bump for travis

* Updating so we don't cache ActiveRecord objects

* Selecting only applicable attributes for caching

* Apply suggestions from code review

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Adjusting code based on feedback

* Bump for travis

* Bump for travis

* Update app/decorators/user_decorator.rb

Co-authored-by: Michael Kohl <citizen428@forem.com>

Co-authored-by: Michael Kohl <citizen428@forem.com>
2022-01-24 19:53:48 -05:00
Ben Halpern
4960f8913f
Refactor AB Experiments and exercise all variants in rspec (#16236)
* Refactor AB Experiments and exercise all variants in rspec

* Fix test that still uses wut
2022-01-24 17:03:58 -05:00
Nick Taylor
d227bbf770
Now <viewbox /> is preserved in SVGs when using the inline-react-svg plugin (#16287) 2022-01-24 16:25:14 -05:00
Nick Taylor
382b5528c7
Now the close X SVG icon is imported via the inline-react-svg plugin for the Modal component (#16288) 2022-01-24 16:01:21 -05:00
dependabot[bot]
fb15644f65
Bump sass from 1.47.0 to 1.49.0 (#16277)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-24 15:17:48 -05:00
dependabot[bot]
ce44780250
Bump @storybook/addon-backgrounds from 6.4.9 to 6.4.14 (#16280) 2022-01-24 14:52:29 -05:00
dependabot[bot]
de19d341d8
Bump @storybook/addon-a11y from 6.4.10 to 6.4.14 (#16278) 2022-01-24 14:50:52 -05:00
Jeremy Friesen
7320a1ee5d
Appeasing rubocop (#16286)
* Appeasing rubocop

* Bump for travis
2022-01-24 14:46:49 -05:00
Arit Amana
b00f68b7fe
Complete implementation and add specs (#16274) 2022-01-24 14:23:16 -05:00