Commit graph

19 commits

Author SHA1 Message Date
Rajat Talesra
cce51588db
Replace uses of toBeDefined with toExist (#19862)
* Replaced toBeDefined with toExist

* Revert db changes
2023-08-04 19:58:58 +05:30
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
Jeremy Friesen
af2e1f0545
Expanding the range of followed tags we show (#16213)
The fix might be a bit of a work-around for a more general approach, but
we're fighting against the magic of the points vs. explicit_points
tension as defined in the [Follows::UpdatePointsWorker][1].

That is to say, it's possible (and happens) where I have assigned an
`explicit_points` of 1 for a tag, but the calculated `points` are less
than 1.  The calculated `points` are what we send forward in the
[AsyncInfoController][1] (by way of the
[UserDecorator#cached_followed_tags][3] method).

In DEV, I ran the following queries:

**User assigned points `>= 1` but calculated `< 1`**

985,352 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points < 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 1`**

5,366,478 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points >= 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 0`**

0 records.

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points <= 0
  AND explicit_points >= 1;
```

**User assigned points `<= 0` but calculated `> 0`**

1,146 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points > 0
  AND explicit_points <= 0;
```

Synthesizing that, almost 1 million tag follows of the total 6.3 million
are not showing up in the user's left navigation.  And 5.3 million are
roughly correct.

In adjusting the logic, we're now going to have more tags showing up in
the left.  And just over 1,000 might now show up that would be unexpected.

Closes #14937.

[1]:c63e0b629e/app/workers/follows/update_points_worker.rb
[2]:c63e0b629e/app/controllers/async_info_controller.rb (L40-L65)
[3]:c63e0b629e/app/decorators/user_decorator.rb (L23-L34)
2022-01-20 19:46:42 -05:00
ludwiczakpawel
9b7503fde3
Update left sidebar links with new Crayons components (#15757)
* update

* hamburger fix

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

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

* updates

* spec

* social media icons

* reading list counter

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-12-20 08:46:30 +01:00
Suzanne Aitchison
1dda5b4058
fix some prop type errors on the home page (#15314) 2021-11-10 13:47:55 +00:00
Papu Kumar(ReX)
33742e7907
Fix PropTypes Error Create New Post Page (#14969) 2021-10-11 09:48:24 -04:00
Michael Kohl
081f43b356
Don't include "anti-followed" tags in email digest (#14782)
* Separate followed and "anti-followed" tags

* Minor code change

* Indicate "anti-followed" tags in sidebar

* Fix UpdatePointsWorker spec

* Cries in Arel

* Use antifollow scope more selectively

* Add spec for not_cached_tagged_with_any scope

* Add explanatory comment

* Remove unused route

* Update comment

* Remove unrelated change, figure out why > 1 later

* Need more 

* Avoid false positives in spec

* Change handling of ingored tags in sidebar

* Add explanatory comment
2021-09-30 10:44:38 +07:00
Suzanne Aitchison
ba7fa0ad11
add temporary ahoy stats for tag sidebar clicks (#14688) 2021-09-09 08:31:27 -05:00
Suzanne Aitchison
dcecc8bf00
Log prop-types warnings to console in development (#14635)
* enable debug for warnings in dev env

* remove preact/devtools call no longer needed

* fix majority of proptype errors on home page

* sweep up proptype errors from listings page

* fix article form error
2021-09-01 09:27:58 +01:00
Jacob Herrington
20f4890051
Replace redundant div with Fragment (#12613)
* Replace redundant div with Fragment
2021-02-09 11:41:46 -06:00
Ben Halpern
467e99556c
[deploy] Fix tag display bug and crayonsify area (#10868)
* Fix tag display bug and crayonsify

* Fix some specs

* Remove unused tag js

* Adjust to remove crayons card bg

* Adjust padding

* add spacing below nav

* drop unnecessary classname

* cleanup headers

* links

* Finalize style and add hint to eliminate div jump

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
2020-10-20 16:07:17 -04:00
rhymes
cd65273571
Use explicit name for Preact fragments (#10049) 2020-08-28 10:01:17 -04:00
Nick Taylor
63b4d9fdc0
More frontend test cleanup (#8919) 2020-06-25 18:04:01 -04:00
Nick Taylor
653ec12300
Upgrade to Preact 10.4.4 (#8739)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2020-06-18 10:07:17 -04:00
ludwiczakpawel
39295c0bea
Layout updates (#8107)
* flare tag line height

* .

* init

* widgets

* widgets lists

* new tabs on home

* instantclick

* .

* rethinking css

* .

* .

* empty space

* campaign widget

* .

* merge

* .

* update layout

* fix sidebars on home page

* .

* fix onboarding x

* spec

* test

* test

* better handling ads

* .

* spec

* card styling

* .

* i dont know what have i broken
2020-06-04 16:12:17 +02:00
Nick Taylor
be5f80a04b
Moved common-prop-types out of src/ folder (#7871) 2020-05-14 16:58:29 -04:00
Ben Halpern
e977f4c357
Fix homepage back button flicker (#6688) [deploy]
* Fix homepage back button flicker

* Update tags
2020-03-17 22:40:49 -04:00
ludwiczakpawel
a77dfefc2a
Homepage UI Improvements (#5890) [deploy]
* de-emphasizing right sidebar: mostly colors & spacing

* adding a bit more love to typography in sidebar

* changing language on LISTINGS widget header

* hiding profile widget from left sidebar

* cards shadow now looks like a bit less random and annoying

* actually doing the same with all shadows! YOLO

* some spacing cleanups around sidebars

* this time some typography love

* im committing but not really sure what exactly

* adding a bit more love to feed card

* looks like i broke some other views.. time to fix em all

* cleaning up typography a bit more

* .

* separating empty search results styling

* created a card styling mixing to reduce some code.. also moved cheese around a bit

* several more cleanups

* improving responsiveness

* i fixed what i broke

* more cleanups

* org badge

* .

* ...

* responsiveness

* .

* some adjustments

* bring back profile card

* tiny logo adjustment

* bunch of further refainments

* typography

* a bit more refainments

* whoops

* bringing back CTAs styling to loggedout sidebar

* fixes to left tags in left sidebar after merge

* buttons fix

* fixing border-color

* Update app/assets/stylesheets/articles.scss

Typo!

Co-Authored-By: Nick Taylor <nick@iamdeveloper.com>

* .

* css cleanup + double border on article page

* removing unnecessary comments

* get rid of loading glitch

* static vs fixed header

* Update system specs

* Update client test snapshots

* Further modify homepage specs

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-02-19 11:24:44 -05:00
Nick Taylor
0119918237
Homepage left side bar tags followed (#5918) [deploy]
* SASS formatting in action.

* Unnested .sidebar-nav-element in SASS

* Created the <TagsFollowed /> component.

* Mini refactor.

* Left side bar uses <TagsFollowed /> component now.

* Accomodating InstantClick

* Small refactor and added some comments.

* The homepage webpacker pack only needs to be loaded once.

* Added tests for the <TagsFollowed /> component.

* Modified the receive InstantClick callback as per their docs.

* Reverted the data-no-instant on he homepage bundle. It seems to cause issues in certain scenarios.

* Just some tweaks to <TagsFollowed /> component.

* Removed CSS for general img tag in context of sidebar as it does not appear to be used.

* Fixed copy paste error from JSX to HTML.

* Fixed <img /> styles for arbitrary sponsorship widget.

* Fixed a regression that a Capybara test caught.

* Fixed user followed tags on home page tests.

* Fixed logic for loading user data on homepage.
2020-02-11 12:09:23 -05:00