Commit graph

12678 commits

Author SHA1 Message Date
Mac Siri
8bce9f006d
Skip flaky specs (#19665) 2023-06-30 11:51:32 -04:00
Mac Siri
d183f8c670
Disable DD's log_injection in development (#19660) 2023-06-30 10:11:52 -04:00
Rajat Talesra
bc2d7702ee
Standalone "admin" page for each comment (#19644)
* Created separate comments page

* Optimised code for single comment and multiple comments

* Indifual comments poage added

* Minor header change

* Created show method

* Applied review changes

* Removed like button from admin comments page
2023-06-30 00:31:07 +05:30
Josh Klar
1a92880cc8
devxp: Base the application container images off new Ruby base image. (#19633)
This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
2023-06-29 10:50:52 -07:00
Josh Klar
e4d33b316c
devxp: Base the application container images off new Ruby base image. (#19633)
This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
2023-06-29 10:50:26 -07:00
Ben Halpern
e52d53bc42
Add index to billboard placement area (#19648) 2023-06-29 12:14:38 -04:00
Joshua Wehner
e0d7658138
Follow-ups for suggested organizations follows during onboarding (#19619)
* Documentation for /api/follows end-point

* Rename and refactor User suggester

* Clean up feature flag

* User average count should be unscoped
2023-06-29 11:49:01 +02:00
Joshua Wehner
55b4e74a5a
Fix bug: Unable to unfollow topics (#19637)
* Fix bug: Unable to unfollow topics

* Rubocop

* Appease audit?
2023-06-29 09:54:10 +02:00
Ben Halpern
df82994fba
Remove unnecessary fragment cache (#19653) 2023-06-28 15:48:43 -04:00
depfu[bot]
c5b987ab6b
[ruby] Update carrierwave 2.2.3 → 2.2.4 (patch) (#19614)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2023-06-28 14:39:32 -04:00
Josh Klar
b8a33e026c
devxp: Replace forem/ruby image with open-source Debian-based analogue. (#19632)
This builds a Debian-derived base image that targets Ruby 3.0.2 (our
current version lock) to replace `quay.io/forem/ruby`, which is based on
Fedora 35 (and as such, lacks ARM64 support).

The building of this image is not yet automated, I intend to add that as
a follow-up some time vaguely soon-ish. This has been built and pushed
to a temporary tag,
[ghcr.io/forem/ruby:klardotsh-test](https://github.com/orgs/forem/packages/container/ruby/103882793?tag=klardotsh-test).
Once this merges, I'll build and push the result in main (pending any
revisions that come up in PR review) with the following incantation,
which will generate a multiarch manifest:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile.base . -t ghcr.io/forem/ruby:latest -t ghcr.io/forem/ruby:$(git rev-parse --short HEAD) --push
```

This refs, but does not complete, #19626, and is one of several blockers
on the path to getting #19603 merged.
2023-06-28 10:44:56 -07:00
Ben Halpern
76eb81188f
Remove API dependency on fetching tweets and shift to frontend (#19641)
* Remove API dependency on fetching tweets and shift to frontend

* Update app/liquid_tags/tweet_tag.rb

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

* Finalize adjustments to tweet

* Update spec/liquid_tags/tweet_tag_spec.rb

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

* Re-add legacy script support

* Add min-height to calculation

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-28 12:13:32 -04:00
Joshua Wehner
c1b31da6af
Spinner during onboarding follow suggestions (#19622) 2023-06-28 11:25:44 +02:00
Rajat Talesra
28b8980c76
Organisation members page to show all users (#19611)
* Basic implementations

* Working implementation

* See all button added

* Added tests for See All Members button

* Added click test

* Grid design

* Nit fix to trigger build failure

* Applied design changes

* Nit design fixes

* Revert limit

* Applied Ben's suggestion

* Removed fixed hight

* Grid layout changes

* Updated test

* Indentation fix

* Added members page test
2023-06-28 12:35:15 +05:30
Ben Halpern
ce902fe1f8
Only apply overflow conditions to billboard cards (#19649) 2023-06-27 15:39:29 -04:00
depfu[bot]
9973100cea
🚨 [security] [ruby] Update rails 7.0.4.3 → 7.0.5.1 (patch) (#19642)
* Update all of rails to version 7.0.5.1

* Make sidebar billboard margins consistent and handle varied browser sizes for overflow (#19635)

* Fix improper .where.missing

* Adjust article context notification relationship

* Update app/models/article.rb

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

* Update app/models/article.rb

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

---------

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-27 14:21:57 -04:00
Ben Halpern
1ff5e91cce
Make sidebar billboard margins consistent and handle varied browser sizes for overflow (#19635) 2023-06-27 09:48:45 -04:00
depfu[bot]
62ff54cb94
Update all development Bundler dependencies (2023-06-26) (#19636)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2023-06-26 11:54:32 -07:00
Dhanujha R
c9902fce6a
Remove deprecated Organization's columns (#19396)
Co-authored-by: Lawrence <lawrence@forem.com>
Co-authored-by: Mac Siri <mac@forem.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2023-06-26 10:36:33 -04:00
Dhurba baral
3bc04bdcc2
Allows super-admin the ability to remove the role from themselves (#19621)
* Allows removing own role

* Removes dead test case
2023-06-26 09:11:33 -04:00
Ben Halpern
479f7b6c6c
Add unique index constraint to segmented users (#19627)
* Add unique index constraint to segmented users

* Run migration

* Add de-duping query
2023-06-26 09:06:18 -04:00
Ben Halpern
923f66174d
Add accidentally-removed observeDisplayAds line (#19631) 2023-06-23 18:49:17 -04:00
depfu[bot]
959da43ece
[ruby] Update gibbon 3.4.4 → 3.5.0 (minor) (#19613)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2023-06-23 15:14:19 -04:00
Mac Siri
d5ad2ac5e6
Add has_many associations to User model (#19625) 2023-06-23 14:58:55 -04:00
PJ
90780fd97a
Fix comment moderation's UI bugs (#19554) 2023-06-23 09:56:24 -04:00
Joshua Wehner
900f42d224
Try to stop eslint complaining about destructuring (#19629) 2023-06-23 08:51:17 -04:00
Rajat Talesra
67ff8d4efb
Add Edit Profile Image option to Onboarding (#19589)
* Basic implementation

* Nit fix

* Using existing profile update api

* API call working

* Basic full implementation

* Nit fixes in design

* UI changes

* Image upload limit set

* Removed drag & drop

* Image size issue fix

* Minor naming fixes

* Removed native mobile code

* Nit fix

* Added few tests

* Added test

* Added test

* Added image upload error

* Added validateFileInput test failure case

* Updated code to test fix

* Revert db changes

* Minor design fixes

* Minor updated test

* Added validateFileInputs test temporarily

* Added processImageUpload test temporarily

* Aded files count test

* Minor warning fixes

* Updated placeholder text

* Added tests for TextInput and TextArea

* Removed un-required test file

* Removed un-required code

* Minor code cleaning
2023-06-23 16:08:27 +05:30
Mac Siri
35a2f8b026
Add Error handling to billboards.js (#19566) 2023-06-22 10:20:34 -04:00
Dhurba baral
4e1edc9225
allows super_admin user to remove super_admin role (#19590)
* Skips scheduled posts in featured post count

* Allows removing super_admin role

* adds namespace resolution op

* Adds pundit policy

* Adds rspec for role policy

* Fixes test cases and minor refactoring

* Removes dead code

---------

Co-authored-by: Lawrence <lawrence@forem.com>
2023-06-21 11:22:25 -04:00
Ben Halpern
f0e99c6279
Add Cloudflare to Images::Optimizer options (proof of concept) (#19574)
* Add cloudflare image option

* Add tests for cloudflare

* Update app/services/images/optimizer.rb

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

* Avoid nested prefixes in cloudflare

* Update spec/services/images/optimizer_spec.rb

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

* Update spec/services/images/optimizer_spec.rb

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

* Update spec/services/images/optimizer_spec.rb

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

* Update app/services/images/optimizer.rb

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

* Update spec/services/images/optimizer_spec.rb

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

* Rebase

* Refactor optimizer and finalize tests

* Skips scheduled posts in featured post count (#19563)

* Add image title for comment (#19586)

* Add image title for comment

* Break out boolean logic

* Add organizations to onboarding follow suggestions (#19564)

* Prepare: relocate user suggestions

* Prepare: relocate users suggestion service -> query

* Organization query for orgs with above-average scores

* Rubocop

* Limit to last 3 weeks

* Tweak recent scope, limit to 5 orgs

* Onboarding routes are also always JSON

* Divide by zero makes NaN means

* Add Orgs suggester into suggestions

* Rubocop

* select distinct orgs

* Fix for weird edge-case with bad local data

* Include type_identifier in JSON payload

* Update follows API to allow org_ids as input

* Update onboarding front-end to distinguish users/orgs

* Fix: i18n issues

* Fix: type_identifier in json output

* Fix: distinct is weird

* Fix: JS linter

* Continue tweaking front-end

* Audit import order

* Cleanup @todo note

* Try renaming controller action

* Move Article average calculation to postgres and fix math

* Refactor decorated type_identifier

* Refactor SuggestProminent, return more orgs, fix spec math

* Use FeatureFlag for organization suggestions

* This might fix the jest

* Sort organization members and tag moderators by badge count (#19582)

* show tag moderators in descending badge count order

* show organization users in descending badge count order

* specs & docs for find_each_respecting_scope

* Update spec/services/images/optimizer_spec.rb

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

* Update spec/services/images/optimizer_spec.rb

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

* Update spec/services/images/optimizer_spec.rb

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

* Update spec/services/images/optimizer_spec.rb

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

* Update spec/services/images/optimizer_spec.rb

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

* Update app/services/images/optimizer.rb

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

* Remove cloudflare typo

* Adjust cloudflare prefix line in tests

* Clean up test logic

* Update spec/services/images/optimizer_spec.rb

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

* Update app/services/images/optimizer.rb

Co-authored-by: Mac Siri <mac@forem.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joshua Wehner <joshua@forem.com>
Co-authored-by: Dhurba baral <dhurba87@gmail.com>
Co-authored-by: PJ <pj@forem.com>
Co-authored-by: Mac Siri <mac@forem.com>
2023-06-21 09:42:06 -04:00
Joshua Wehner
a4419a249a
Suggested follows copy changes (#19596)
* Suggested follows copy changes

* See if this makes codecov happier?

* Still trying to appease codecov

---------

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2023-06-21 09:40:39 +02:00
depfu[bot]
8bdd0e1fa5
Update sidekiq to version 6.5.9 (#19572)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2023-06-20 13:48:32 -07:00
depfu[bot]
37ef5c88fd
[ruby] Update oj 3.14.3 → 3.15.0 (minor) (#19605)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <mac@forem.com>
2023-06-16 16:03:13 -04:00
depfu[bot]
7b9c03429c
[ruby] Update cloudinary 1.25.0 → 1.26.0 (minor) (#19593)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2023-06-16 15:52:08 -04:00
Rajat Talesra
150199e0d2
Add more visibility and control around reactions/flags into the Admin USERS page (#19558)
* Basic implementation without dropdown

* Dropdown functionality

* Partial i18n

* Nit fixes

* Nit fixes

* Flag count fix

* I18n fr.yml

* Nit design fix

* added external div to article_item

* added external div to article_item

* Code merge of article_item and individual_article

* Minor bug fix

* Extacted more common code

* Nit fix

* Optimised code

* Optimised code

* Ni fix

* Test fix

* Minor suggested changes applied

* Nit fix

* Nit fix
2023-06-15 22:08:45 +05:30
Mac Siri
165f0bbf1f
Revert "Restructure the way we render the feed + add billboard locati… (#19610) 2023-06-14 14:27:58 -04:00
Ridhwana
b98dbd4035
Restructure the way we render the feed + add billboard locations on signed in feed (#19533)
* feat: fix of there is no article

* feat: set the feed order in a data structure rather than in a view

* feat: update yarn.lock

* feat: push the items to the array

* feat: update feed to only show billboards if we have the correct length of items in the feed

* fix: organizedFeedItems.legth

* feat: rename 'featured' to 'image'

* feat: rename 'featured' to 'image'

* feat: rename 'featured' to 'image'

* feat: add some utilities for the feed that we can use in the FeedTest

* feat/WIP: the setup for the feed tests and a first working test

* test: imageItem

* fix: the podcasts can be passed through as an array of objects in the feedItems so that they can be grouped in one card

* feat: remove podcastEpisode state and the attribute in the object

* fix: check that the items exist before trying to slice them

* feat: setup the userdata and the podcast data in the test

* whoops - commit the podcast episodes

* feat: write soem more tests for the feed and including the podcasts

* feat: add some more tests

* feat: add more billboards tests to chcek the order of stuff

* feat: set the timeframe not empty

* feat: update the logic for organizaed feed by inserting the last on first

* doc: jsdoc for functions

* refactor: break the code up into smaller functions

* refactor: make the code more readable and easier to follow

* refactor: pull function out into a utlity

* feat: add specs to utility

* feat: chcek if pinned post

* test the latest timeframe correctly

* chore: update var name

* move the podcast items out of the object clause

* feat: update text

* feat: add a pack file that duplicates initializeDisplayAdVisibility

* feat: create callbacks that will help us to determine when the feed has been rendered so that we can observe the dsplay ads accordingly

* chore: rename to billboards instead of display ad
2023-06-14 12:29:56 -05:00
depfu[bot]
e5c7c8cecf
[ruby] Update knapsack_pro 3.11.0 → 5.1.0 (major) (#19606)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2023-06-13 14:03:45 -04:00
depfu[bot]
4cdcdab65a
Update sterile to version 1.0.25 (#19598)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
2023-06-12 17:33:18 -04:00
Ben Halpern
5d6dc64245
Add ability to mark billboard (display_ad) as "priority" (boolean) (#19599)
* Add ability to mark billboard (display_ad) as "priority" (boolean)

* Fix invocation

* Update spec/models/display_ad_spec.rb

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

* Update spec/models/display_ad_spec.rb

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

* Update spec/models/display_ad_spec.rb

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

* Update spec/models/display_ad_spec.rb

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-12 16:28:15 -04:00
PJ
6de70e3810
Sort organization members and tag moderators by badge count (#19582)
* show tag moderators in descending badge count order

* show organization users in descending badge count order

* specs & docs for find_each_respecting_scope
2023-06-09 15:30:46 +01:00
Joshua Wehner
c2a131e43d
Add organizations to onboarding follow suggestions (#19564)
* Prepare: relocate user suggestions

* Prepare: relocate users suggestion service -> query

* Organization query for orgs with above-average scores

* Rubocop

* Limit to last 3 weeks

* Tweak recent scope, limit to 5 orgs

* Onboarding routes are also always JSON

* Divide by zero makes NaN means

* Add Orgs suggester into suggestions

* Rubocop

* select distinct orgs

* Fix for weird edge-case with bad local data

* Include type_identifier in JSON payload

* Update follows API to allow org_ids as input

* Update onboarding front-end to distinguish users/orgs

* Fix: i18n issues

* Fix: type_identifier in json output

* Fix: distinct is weird

* Fix: JS linter

* Continue tweaking front-end

* Audit import order

* Cleanup @todo note

* Try renaming controller action

* Move Article average calculation to postgres and fix math

* Refactor decorated type_identifier

* Refactor SuggestProminent, return more orgs, fix spec math

* Use FeatureFlag for organization suggestions

* This might fix the jest
2023-06-09 10:32:03 +02:00
Ben Halpern
e573ba32d1
Add image title for comment (#19586)
* Add image title for comment

* Break out boolean logic
2023-06-08 17:11:20 -04:00
Dhurba baral
a345aabc2b
Skips scheduled posts in featured post count (#19563) 2023-06-05 19:32:10 -04:00
Joshua Wehner
afa74111a8
Fix mod notifications for draft posts (#19575)
* Fix mod notifications for draft posts

* Rubocop
2023-06-05 17:02:11 +02:00
Ben Halpern
4ffe7b0fab
Remove loading-ellipsis.svg and related code (#19569) 2023-06-01 10:41:53 -04:00
depfu[bot]
d162fee7f0
Update pg_query to version 4.2.1 (#19549)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2023-06-01 08:57:01 -04:00
Ben Halpern
0e5281cfb6
Fix cls with min-height for multiple reactions (#19570) 2023-06-01 07:39:51 +05:30
Tom Hughes
6d919acc63
fix: prevent dashboard following lists rendering stale content (#19397)
Co-authored-by: Lawrence <lawrence@forem.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Philip How <philip.j.how@gmail.com>
2023-05-31 17:52:12 -04:00
Kireeti
b35dbeecb4
Update multiple_reactions_engagement's alignment (#19484) 2023-05-31 17:42:31 -04:00