Commit graph

403 commits

Author SHA1 Message Date
Ben Halpern
34df26c847
Put Algolia frontend behind feature flag (#20935) 2024-05-09 09:22:15 -04:00
Ben Halpern
1287c343b6
Add search branding option (#20902)
* Add search branding option

* Change search test
2024-04-29 14:02:47 -04:00
Ben Halpern
a2b078e6de
Add Algoliasearch js client (#20871)
* Add Algolia client for future use if enabled

* Make key fixes

---------

Co-authored-by: Mac Siri <mac@forem.com>
2024-04-19 18:13:30 +00:00
Ben Halpern
501b900108
Small digest style tweaks (#20763) 2024-03-11 18:09:17 -04:00
Ben Halpern
eb8006a841
Make ahoy_email default_options[:click] an env var (#20757)
* Make ahoy_email default_options[:click] an env var

* Also noted a typo here

* Manually mount AhoyEmail::Engine

* Disable by default

---------

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2024-03-11 15:43:55 -04:00
Ben Halpern
0d4f7c7e19
Add new simple a/b test for Digest subject and adjust config and design details (#20754)
* Adjust Digest Email design and configuration

* Adjust some tests

* Update tests

* More adjustments to markup and tests

* More adjustments to markup and tests

* Digest email feature flag

* Test title variants
2024-03-11 13:02:19 -04:00
Ben Halpern
17d81b6cb1
[Hotfix] Fix cache key (#20658)
* Fix cache key

* Small style tweak
2024-02-19 19:24:36 -08:00
Ben Halpern
6ef9a83252
Make mobile runtime banner optional (#20637)
* Remove runtime banner

* Show/hide runtime banner setting

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

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

* Update app/views/layouts/application.html.erb
2024-02-16 10:45:41 -08:00
Mac Siri
afa73e06e3
Replace Webpacker with Esbuild (#20470)
* Migrate to esbuild WIP

* Add exclude

* Remove redundant file

* Move file

* Move to javascript_include_tag

* Lint fix

* WIP

* WIP

* Add watch mode to esbuild WIP

* Get jest working

* Remove babel

* Revert "Remove babel"

This reverts commit 6da35260aa19d6f97f586deb66c0ecaf48433b73.

* More WIP

* Got image to load

* WIP

* Resolve audit

* Lint fix

* WIP

* Fix jest spec

* [CI] Remove asset-restore for test build stage

* Production compliant

* Temp disable sourcemap

* Update glob

* Add esbuild helper to stimulus

* Import fragment

* Temp disable coverage to see failing tests

* Fix broken spec

* Address lint

* Set proper es6 target

* Use esbuild for everything

* wait what

* Revert "Set proper es6 target"

This reverts commit 98f5278093421baa8ffe2ca580845b01c1a1eadf.

* Revert "Use esbuild for everything"

This reverts commit 0ac46738f07ffcb6af095ccb1ffa5e439b7fefa3.

* Replace uglifier with terser

* New compiled assets version

* Remvoe honeybadger-io/webpack

* Remove cypress coverage checks for now

* Update jsconfig.json

* Update docker-compose

* Remove public/packs-test from ci cache
2024-01-25 20:29:21 +00:00
Philip How
c11160d2f7
switch class for mod icon in top bar (#20540) 2024-01-19 09:33:54 -05:00
Ben Halpern
16ff57c2ff
Add HTML customization to admin (#20531)
* Add HTML customization to admin

* Update spec/requests/stories_index_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>
2024-01-17 12:12:22 +00:00
Ben Halpern
ae2371d9a4
Add configuration for admins to determine whether to show cookie banner (#20517)
* Cookie banner admin config (wip)

* GA4 consent mode based on cookie acceptance

* Fix i18n

* Merge upstream

* Adjust heading
2024-01-15 18:22:17 +00:00
Ben Halpern
f4081b2e24
Functionality to allow admins to add a cookie consent notice (part 2) (#20488)
* Initial work on base cookie modal

* Update app/assets/stylesheets/components/modals.scss
2024-01-04 16:20:03 -05:00
Rajat Talesra
a679486572
Redesign sign-up and login pages (#20065)
* Signin Signup screen update

* Design for signin signup finished

* On hover effect

* Fixed few tests

* Fixed rSpec tests

* Minor design fixes

* Design changes suggested by Anuj

* Test fixes

* Updated test

* Nit fixes

* Path changes and footer and topbar hidden

* A bit simplified css

* Removed custom css

* Updated tests

* Nit css fixes

* Updates as per Ridhwana's review

* CSS fixes

* Used js-registration
2023-09-13 21:46:57 +05:30
PJ
c202afdec6
Show billboards to users by location (async requests) (#19886)
* use HTTP_CLIENT_GEO in billboards show action

* limit targeting to signed in users

* re-add cypress test

* simplify billboards request spec

* fix header problems hopefully?

* whoops

* Squash filleduchaos/caching-billboards-by-location

* export ISO 3166-2 regions
* wip
* remove ISO 3166-2 regions
* finally, a VCL config that...works?
* update billboard controller & specs

* fix specs

* clean up and document VCL some more

* remove vcl_init sub

* remove billboard fragment caching
2023-08-09 19:07:57 +01:00
Rajat Talesra
d1a2fd1e6c
Move footer to sidebar on home/post index page (#19784)
* Rebased with main

* Footer visibility bug fix

* Minor fix

* Added tests

* Removed initializeFooter as it is not working as expected

* JS code updated as per suggestion

* Updated cache details

* Rebased with main

* Minor fixes

* Minor fixes

* Update .github/ISSUE_TEMPLATE/-core-team-only---new-approved-feature.md

* Update .github/ISSUE_TEMPLATE/-core-team-only---new-approved-feature.md

* Update .github/ISSUE_TEMPLATE/-core-team-only---new-approved-feature.md

* Update .github/ISSUE_TEMPLATE/-core-team-only---new-approved-feature.md

* Update .github/ISSUE_TEMPLATE/-core-team-only---new-approved-feature.md

* Update .github/ISSUE_TEMPLATE/-core-team-only---new-approved-feature.md

* Removed JS logic

* Nit fix
2023-08-02 19:13:10 +05:30
Anna Buianova
5ea3490b6e
Renamed leftover @hero_display_ad => @hero_billboard (#19874) 2023-08-01 21:15:05 +03:00
PJ
9754d14182
Fix intermittently broken reaction images on home feed (#19779)
* move reaction icons to base layout

* fix reactions count specs??

* also fix article specs
2023-07-27 19:48:07 +01:00
Lawrence
1b32e9a8e3
Hero Billboard Placement (#19467)
* init

* add option to swagger docs

* in_house validation

* filtered ad quesry changes

* styling and prioritizing home hero banner over campaign banner

* rubocop

* typo

* broken spec

* more spec fixes

* found the spec break culprit

* derp

* Update app/views/shared/_display_ad.html.erb

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

* Update app/controllers/stories_controller.rb

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

* remove immediate return

* styling feedback and moving banner to articles index

* remove nil

* updated styling

* add signed in bool

* add feature flag

* remove feature flag data scripts

---------

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2023-05-18 12:37:32 -05:00
Ben Halpern
d46b54330e
Revert hidden shell cleanup (#19059) 2023-02-06 10:43:11 +02:00
Lawrence
3186f7ae2d
CommentDate Migration to Pack tag (#19025)
* migration init

* create an initializers directory

* remove console log

* migrate localDateTime functions and remove comment date from asset pipeline

* add unit test

* add one more

* year test
2023-02-03 13:40:17 -06:00
Ridhwana
aa305ddcaf
remove some old service worker code (#19036) 2023-02-03 11:51:04 +02:00
Lawrence
df678d2c03
baseTracking Initializer Migration (#19016)
* baseTracking pack

* Define dataLayer

* disable unused var

* disable another unused var

* remove initializer call from base of asset pipeline

* remove asset pipeline baseTracking file
2023-02-02 13:15:36 -06:00
Fernando Valverde
de6a5a0f07
Include Mastodon as social media option with rel=me attribute for verificatiion (#19015)
* Include Mastodon as social media option w/ rel=me attribute

* Extract social media from overloaded partial - admin config
2023-02-01 09:51:51 -06:00
Joshua Wehner
7f41dae631
Pages API: Read (get index+show) (#18970)
* Pages API pt 1 (read/get/index+show)

* Update spec/requests/api/v1/docs/pages_spec.rb

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

* Update spec/requests/api/v1/docs/pages_spec.rb

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

* API Key not required for index & show

* API Feature flag has long since been removed

* Page schema

* Fix spec broken by merge

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2023-01-25 17:15:27 +01:00
Rajat Talesra
ff790c147e
Removed jQuery usage from admin ( -- now it exists only in views/videos) (#18976)
* Remove jQuery

* Added jquery back to videos

* Removed jquery code

* Nit fix

* Revert incorrect code

* Updated jquery code to javascript

* Removed jquery from comments
2023-01-24 21:03:12 +05:30
Rajat Talesra
4ae1721848
Remove bootstrap library fully with some minor fixes (#18945)
* Minor fixes

* Replaced justify-content-between with justify-content

* Override all heading tags, paragraph tag

* Fixed a tag underline css

* Removed bootstrap library

* Removed duplicate crayons-select class
2023-01-16 20:07:12 +05:30
Rajat Talesra
497f494ef3
Removed nav related classes from feedback tabs (#18924)
* Removed bootstrap from listing_categories, listings, navigation_links

* Removed not-used bootstrap classes from admin/tags

* Removed bootstrap from admin/settings

* Fix collapse glitch in profile-fields

* Feedback partial progress

* Feedback partial progress

* Removed form-control

* Replaced card with crayons-card

* Fixed profile field UI

* Removed collapse hide and show classes

* Removed collapse hide and show classes

* Removed collapse hide and show classes

* Nit height fix

* Nit width fix

* Updated tests

* Removed nav related classes from feedback tabs

* Remove btn-classes from commets too.

* Removed row and col-12 classes

* Removed bootstrap classes from Authentication

* Removed bootstrap classes from Mascot

* Removed bootstrap classes from Onboarding

* Removed bootstrap classes from lock/unlock discussions

* Notes design changes

* Removed bootstrap classes from Organization

* Removed bootstrap classes from Organization

* Remove alert bootstrap class from admin.html.erb

* Fixed tab_pane related code

* Enable click listener on notice

* Enable click listener on notice

* Applied suggested changes

* close bootstrap class removed

* Removed element completely
2023-01-09 20:18:28 +05:30
Ridhwana
790870b459
Add Footer Links (#18886) 2022-12-22 20:33:02 +02:00
Ridhwana
6cb97eeb01
Async Hamburger Menu Implementation + Caching Optimizations (#18818) 2022-12-20 20:00:08 +02:00
Rajat Talesra
8f90d1b378
Remove “Shield” icon in nav for Trusted Users - except admins and tag-moderators (#18791)
* Removed shield icon - conditionally

* Updated tests

* Reverted trusted-status code

* Updated code for shield icon

* Nit optimisation

* Updated tests

* Updated tests

* Nit fixes

* Nit fixes

* Trying to fix line-length issue

* Revert this space in next commit

* Fake commit to restarst CI

* Re-enabled rubocop

* Nit fix
2022-12-07 15:40:44 +05:30
Ridhwana
9dee48dbc2
Add tracking for the registration flow - "Clicked on Create Account" (#18459)
* refactor: move trackEvents to a utilities folder so that it can be re-used

* feat: add a function called trackCommentClicks and use it on the articlePage

* feat: update the auth widget to take the correct properties

* feat: add create account tracking method for hamburger

* feat: add create account tracking method for sidebar left

* feat: whoops, sidebar tracking info added

* feat: add the feed card create account tracking

* feat: whoops add the id to the dom

* feat: add top nav create account tracking

* feat: create account tracking for the registration modal

* fix: callback instead of invoking + rename class

* fix: js-prepend

* feat: some showLogin event tracking

* use the tracking propert

* x - feed.jsx

* fix: oops I removed hidden

* track from the search login

* feat: add tracking for follow button

* fix: main_stories is only being called in view/articles and both are including the FollowButtons pack

* comments track

* feat: remove punc (.)

* chore: cahnge working

* chore: remove tracking-id from modal

* feat: remove ecmascript features

* refactor: rename some events

* feat: referrer page

* feat: add a secondary source for the follow buttons

* feat: remove file that is not used

* chore: rename key

* feat: use @utilities

* feat: add spec for create account clicks

* feat: add key referrer

* fix: tests

* fix: oops

* chore: add commented test

* test for tracking

* feat: update the change by 1

* feat: aggregate_failures

* feat: add data-no-instant back

* feat: try a different way of testing

* refactor: change secondary_source to referring_souce

* feat: change ahoy event test

* feat: add a version number to ahoy tracking

* feat: change the href to pathname

* feat: reply comment tracking

* fix: to be present syntax

* feat: use href instead of pathname

* chore: do not track tags and podcasts follow and remove referrer

* feat: add readinglist

* fix: remove referrer from test

* feat: fail gracefully in instances where there is no tracking data
2022-09-22 16:03:49 +02:00
Josh Puetz
fc1031f52a
Add Google Analytics 4 Support (#18124) 2022-07-21 09:26:13 -05:00
Takuya N
1cb86b973a
Update Bootstrap from 4.4.1 to 4.5.3 (#17391)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-22 07:37:12 -04: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
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
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
ludwiczakpawel
73d6d9802e
fix (#17141) 2022-04-06 11:13:44 +02:00
Jeremy Friesen
c3c884f4d0
Conditional rendering of "Create Post" link (#17076)
* WIP - Conditional rendering of "Create Post" link

This PR builds on the conversation from forem/forem#17056 and moves in a
slightly different direction.

Important in all of this is that the ability to create a post is
enforced on the server.  If the "Create Post" button were to be visible
but the user couldn't create a post when they clicked the button, they
would get an authorization error (or some such response).

This PR posits a different and perhaps competing approach to
forem/forem#16606.  This PR provides a general approach in which we add
class attributes in our HTML erb files.

Note: I have not included Cypress tests as I don't want to yet commit
that time.  I'm also wondering if this is the "right" thing to do.  I
definitely think we want to add some JS tests.  But could we do JS and
unit tests?  (How do we reach consensus regarding our test approach?)

Again, thank you for the conversation and expect an even more "complete"
PR after we have our discussion.

* Extracting AsyncInfo model to ease testing

* Renaming forbidden to visible

* Adding cypress test to assert no 'Create Post'

These are always treacherous.  What happens when we rename the button?
The test will continue to work.

* Apply suggestions from code review

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

* Switching to pack file for policy

Follows on [Suzanne's comment](https://github.com/forem/forem/pull/17076#issuecomment-1088567286)

* Update app/javascript/packs/applyApplicationPolicyToggles.js

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-05 12:47:12 -04:00
Suzanne Aitchison
87dc5da17b
tweak crayons layout for admin section (#17122) 2022-04-05 13:14:50 +01:00
Dwight Scott
1cb45995cb
conditionally render create post button for admins #16490 (#16606)
* Trigger Build

* WIP - use turbo to render html for create post button

todos and discussion topics
[] add tests (probably gonna be a lot of cypress 😅😭)
[] nominclature & file structure for authorization controller/routes
[] is this "authorizations" namespace approach the best?
[] authorization strategy relies on current user and caching doesn't
like `current_user`

* Use URL helper and not change the policy just yet

* put the turbo frame behind a feature flag

* Trigger Build

* Use URL helper and not change the policy just yet

* :)

* Add some test coverage and use same feature flag for consistency

* rubocop

* more rubocop

* trigger build

* adding a small sleep to see if specs pass 😩

* remove sleep

* disable Turbo session drive

* WIP

* Revert "WIP"

This reverts commit ce838672069fd703122156a0d82e5e6ad5398e0a.

* Moving spec from dashboard to root

With forem/forem#16913 the underlying test broke because we were
redirecting on the dashboard.

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
2022-03-29 13:04:57 -04:00
Jeremy Friesen
71e9f2bfb4
Refactoring AdminMenu and Menu towards classes (#16847)
As I was looking to implement the new Spaces feature (see
forem/forem#16842), I began looking at how to adjust the admin menu.  I
found the Menu and AdminMenu.  I wanted to add the "spaces" item under
the `:content_manager` scope.  Looking at the implementation, I saw I
would need some additional branching logic.

To get an understanding of the implementation, I chose factor towards
classes.

This refactor does a few things:

1) Clarifies a method name (e.g. "children?" becomes
   "has_multiple_children?")
2) Adds some tests of the menu implementation.
3) Removes deeply nested hashs in favor of first class objects.
4) Removes a complex method for determining menu visibility, instead
   favoring a method that either takes a boolean OR a lambda.

There are further refactors to consider, especially in regards to the
helper methods and some of the coercion of strings into different
formats.  But this refactor gets me the part I most am interested in:

Making it easier to specify a menu item as visible or not.
2022-03-21 13:31:20 -04:00
ludwiczakpawel
b321d1ec11
Removing bootstrap: admin sidebar navigation (#16618)
* nav

* nav

* move cheese around

* helpers

* optimize

* optimize

* optimization

* optimization

* children helper

* children helper

* Update app/views/admin/shared/_nested_sidebar.html.erb

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-01 15:46:45 +01:00
ludwiczakpawel
ec41d12246
theme-color (#16651) 2022-02-22 15:52:14 +01:00
Suzanne Aitchison
4d07a1ef7b
Tweaks to the admin flash messages flow (#16582)
* Focus flash message button on load

* update specs

* Update app/javascript/packs/admin/flashMessages.js

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

* Update app/javascript/packs/admin/flashMessages.js

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

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2022-02-16 10:07:21 +00:00
Nick Taylor
7e1869f1d1
Added E2E tests for new admin member details view (#16513) 2022-02-11 08:47:01 -05:00
Daniel Uber
39c5bcd518
remove activex fallback for internet explorer (#16453)
* remove IE6 XHR support

IE7 and later support XMLHttpRequest natively, and most of the rest of
the code base uses fetch() which may not work in any version of IE

Drop the conditional here in the assumption that this would only be
the first of many problems for a user with an unsupported browser.
2022-02-08 08:36:04 -06:00
Jeremy Friesen
2fd94fcc87
Ensuring that body.dataset is JSON parsable (#16441)
Prior to this commit, if our community name included a `"` we would
encounter a parse error.  Using the [j][1] which is a terse alias for
[escape_javascript][2], we will now be escaping those characters that
cause grief in some of our parsings.

I believe there is a larger audit that needs to occur regarding all
`data-` renderings.

Hopefully this will catch a flakey test.

Closes #16440

[1]:https://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#method-i-j
[2]:https://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#method-i-escape_javascript
2022-02-08 07:30:43 -05:00
yheuhtozr
c4778d832e
app/controllers & decorators i18n (#16126)
* app/controllers (& decorators) i18n etc

* tidy key names

* update keys

* delete ja.yml

* delete an involved ja.yml

* fix for PR review

* fix for spec

* delete ja.yml
2022-02-03 13:35:56 -05:00
Jeremy Friesen
b4b1212a33
Adding conditional rendering of navigation links (#16362)
Prior to this commit we had an inline logic check on whether or not to
render a navigation link.  As we are looking to rollout the feature flag
for Listings, we needed to add another somewhat complex conditional.

This commit moves the inline conditionals to a helper function, which
makes testing the logic far easier.  Especially since we need to bombard
the tests with the combination of 3 different boolean checks.  (And one
of those boolean checks requires even more but could be stubbed).

There should be no UI differences, as we're presently assuming the
Listings feature is enabled.

Related to forem/rfcs#291
2022-02-01 12:23:58 -05:00