Commit graph

36 commits

Author SHA1 Message Date
Ridhwana
5266dd1afb
Showing and hiding tags in the Following and Hidden Tags Pages (#19954)
* feat: remove updated weights

* feat: click on following on the following tags page

* feat: add and listen for the following button click

* fix: dropdowns

* feat: handle hide button click

* feat: update the nav link for following tags

* feat: handel the 'unhide button' on the hidden tags page

* feat: add the styling for the buttons

* feat: add localization

* feat: remove the brand from the card

* feat: add some styling to the page

* feat: init scrolling

* chore: update the name of the file

* feat: abstract out the comment fetch code

* fix: close the attribute

* feta: make some adjustments to where the tag adn the follow show up

* rename class from plural to singular

* feat: updae the comment

* feat: add a mutation observer to initialize the dropdown

* test: follow_craete

* chore: remove irrelevant test

* feat: update the cypress seeds

* feat: update the cypress seeds

* spec: write soem initial tests for the following tags page

* spec: update the unfollow cypress spec

* spec: update the hide cypress spec

* spec: update the posts published spec

* note to add test for pagination

* spec: hidden tags page

* feat: remove aria pressed attributes

* fix: ordering by explicit points gets the page params confused and returns the incorrect and not all results on pagination

* fix: use explicit points

* feat: remove the message at the top of the following and hidden tags page

* chore: remove comment and rather add it to the PR itself

* refactor: do all the actions on success

* feat: refactor the dashboard tag file

* refactor: only show the tagId and followId dataset attributes on the dashboard__tag__container

* feat: disconnect the observer

* chore: add some documentation

* feat: add fr localization

* chore: empty line

* fix: update the dashboardTags page to first declare the observer"
"
"

* fix: update the rails test

* Empty commit

* fix: because I added more tags, the dropdown was longre and covering the body of the editor hence it could not find the text, so I've escaped after selecting my tags
2023-08-25 14:49:39 +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
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
Prayesh Shah
c043339654
Bug Fix: Following an organization from article's sidebar creates an incorrect follow record (#15093)
* Downcase `followable_type` to fix wrong follows creation bug

* Use `follow_button` helper

* Remove puts statement

* Revert use of follow_button helper

* Remove downcase of followable_type from helper

* Refactor switch case for better consistency

* Add e2e test for follow organization from article page functionality

* Split cypress `it` block into two

* Add additional test to following organizations from dashboard

* Remove downcasing of followable_type for decorated objects

* Fix failing follow back spec

* Force capitalize `followable_type` param

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

* Update app/controllers/follows_controller.rb

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2021-11-05 12:40:20 -04:00
Suzanne Aitchison
1ec07d3fe2
Fix UI showing "Following" after unfollowing a user (#13757)
* manually delete cache key on unfollow

* add cypress test

* move deletecached into own service

* rename and tidy up

* Update cypress/integration/profileFlows/followUser.spec.js

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>
2021-05-19 17:40:38 +01:00
Kirk Haines
ed74f2f245
Abstract DatadogStatsClient to ForemStatsClient (#12304)
* This change abstracts the DatadogStatsClient into a ForemStatsClient.
The purpose of this abstraction is to set the foundation for a subsequent PR that will allow one to use New Relic for recording Forem stats, instead of Datadog, if there is a New Relic configuration found.
This specific change creates an abstraction layer that can be built upon, without changing any actual default behavior. All specs still pass.

* Use delegate instead of explicit methods.

* Delegate instead of explicit methods.

* Fix the error.

* Refactor according to the suggestions in the comments.

* Ooops.  Stats work better when all of the code is committed.

* Removing the alias of count to increment since that was done in error.
2021-01-27 11:25:44 -05:00
Chien-Wei Huang (Michael)
025a46e012
Update all followed tag with one click (#11454)
* Replace follows#update with follows#bulk_update

* Allow follows#bulk_update to receive multiple follows and remove follows#update

* Add FollowPolicy#bulk_update? and remove update?

* Combine save button into one in following_tag.html

* Rename follows_update_spec to follows_bulk_update_spec and update

* Update buildTagsHTML to conform to the view

* Allow scrolls down dashboard test to update multiple tag values

* Includes follower and followable in follows#bulk_update

* Mark and pass changed field.

* fix typo in html

* Update follows in transaction

* Extract js script to another file and update view

* Rename disableUnchangedButton.js to dashboardTagsDisableUnchangedButtons.js
2021-01-05 16:15:37 +01:00
Michael Kohl
5185de4c91
Move app/labor/follow_checker.rb to service (#11613)
* Move app/labor/follow_checker.rb to service

* Move to Follows:: namespace
2020-12-01 14:14:36 +07:00
Ben Halpern
d759ac4627
Add implicit points to follows to improve feed relevancy (in all algorithms) (#11513)
* Fix menu dropdown disable issue

* Initial base work

* Add real algorithm

* Add working object and test

* Fix schema

* Fix schema

* Fix schema

* Finalize

* Add update script and explict_points

* Proper implicit/explicit points

* Fix tests

* Add docs

* Fix tests

* Fix data update script test

* Fix data update script test

* Fix typo

* Improve efficiency and add more logic

* Changed to find_each

* Change to bulk insert

* Update tests and refactor logic

* Various improvements

* Fix typo

* Fix tests

* Remove extra line

* Fix tests

* Fix test typo

* Cache site-wide tag names
2020-11-25 16:09:51 -05:00
rhymes
085c60992b
Rubocop: Enable and fix Style/OptionalBooleanParameter cop (#9711)
* Enable and fix Style/OptionalBooleanParameter cop

* Keep regular parameters for workers

* Keep regular parameters for workers

* Fix spec

* Trigger Travis correctly
2020-08-10 19:35:55 +02:00
rhymes
696c712883
Rubocop: routine fixes (#9345)
* rubocop -A

* Fix Style/HashLikeCase

* regenerated todo file
2020-07-16 18:18:13 +02:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
rhymes
9215d04f08
[deploy] Routine Rubocop fixes (#8293)
* rubocop -a fixes

* rubocop --auto-gen-config
2020-06-05 18:46:10 -04:00
Molly Struve
ed8893a734
[deploy] Don't Touch User Twice for New Follow (#7893) 2020-05-15 16:31:43 -05:00
Molly Struve
ea1d38d3b8
[deploy] Bulk Fetch Follow Button Data for Users (#7676) 2020-05-08 13:58:58 -05:00
Molly Struve
ba0ebbafa8
[deploy] RateLimit Refactor: Consolidate Logic for Checking a Limit and Raising an Error (#7636) 2020-05-01 13:31:44 -05:00
rhymes
8c7aa2e494
Rename DataDog to Datadog (#6226) 2020-02-21 12:00:30 -05:00
Gonzalo Ricco
dd796aaef3
Fix raising validation if followable already exist(race condition) (#5826)
* Fix raising validation if followable already exist(race condition)

* Change Rails Logger for DataDogStatsClient and remove 'begin' keyword in follow method

Co-authored-by: Gonzalo Ricco <gonzalo.ricco@leniolabs.com>
2020-02-05 12:25:26 -05:00
Molly Struve
3be406290a
Store FollowChecker responses to Avoid Multiple db Hits (#4886) [deploy] 2019-11-26 13:03:19 -06:00
rhymes
80ab485eb6 Fix http status code for rate limiting (#4742) 2019-11-07 14:11:11 -05:00
Ben Halpern
fc1239b21d
Remove follow limit for single request (#4738) 2019-11-06 18:17:40 -05:00
Omar Bahareth
dca66bd6a8 Rate limit daily user follows to 500 (#4647) [deploy]
* Rate limit daily user follows to 500 per day
Return an error in `POST /follows` JSON response when a user tries to follow more than 500 accounts in a single day.

Other Changes:
- Add a spec for follows#create.

* Turn daily account follow limit into an env var

* Avoid executing today follow count query when possible
user.following_users_count is a counter cache on how many users the person is already following, so if it's less than the limit we don't need to run the query and can just return it instead.

* Simplify today follow count query
Stop needlessly checking into the future, only check from the beginning of the day until now.

* Raise account follow limit error if followable_id count is over limit
Other changes:
- Always return JSON, the `respond_to` block from before was unnecessary since this endpoint always returns JSON.
- Rescue `DailyFollowAccountLimitReached` on the method and remove begin block, since the error can be raised from two places in the same method.

* Index created_at on users table

* Make adding created_at index on users table happen concurrently

* Rename DAILY_ACCOUNT_FOLLOW_LIMIT to RATE_LIMIT_FOLLOW_COUNT_DAILY

* Add RATE_LIMIT_FOLLOW_COUNT_DAILY to Envfile

* Move RATE_LIMIT_FOLLOW_COUNT_DAILY from env var to ApplicationConfig
2019-11-06 16:24:43 -05:00
Ben Halpern
c76abbbdb3
Allow users to follow podcasts (#2690)
* Allow users to follow podcasts

* Only display podcasts user follows

* Add main_color_hex to factory

* Fix podcast test and modify styles

* Fix tests

* Remove weird test
2019-05-04 15:30:40 -04:00
Andy Zhao
8ef611f879 Remove Honeycomb from the app (#2366)
* Remove Honeycomb related gems

* Remove Honeycomb related code from controllers

* Remove Honeycomb from RSS Reader

* Remove Honeycomb related files

* Remove Honeycomb related tests

* Remove leftover Honeycomb methods
2019-04-11 10:49:35 -04:00
Keshav Biswa
8d57d45ecc Rubocop Style cops enabled (#2056)
* Rubocop enabled style/alias

* Enabled Style/ArrayJoin Cop

* Enabled Style/Attr

* Enabled Case Equality

* Enabled CharacterLiteral

*  Enabled ColonMethodCall Cop

* Enabled CommentAnnotation cop

* Enabled PreferredHashMethods Cop

*  Enabled DoubleNegation Cop

* Enabled EachWithObject Cop

* Enabled EmptyLiteral Cop

* Enabled EvenOdd Cop

* Enabled IfWithSemicolon Cop

* Enabled Lambda and LambdaCall Cop

* Enabled LineEndConcatenation Cop

* Enabled ModuleFunction Cop;

* Enable NegatedIf and NegatedWhile Cop

* Enabled NilComparison Cop

* Enabled Not Cop

* Enabled NumericLiterals Cop

* Enabled OneLineConditional Cop

* Enabled PercentLiteralDelimiters Cop

* Excluded internal/users_controller from negated_if cop

* Reverted the double negation change from github_issue_tag and github_issue.rb"

* Enabled PerlBackrefs Cop

* Changed Regexp.last_match(1) to Regexp.last_match(0)

* Enabled proc cop

* Enabled RaiseArgs Cop

* Reverted Regexp.last_match(0) to Regexp.last_match(1)

* Enabled SelfAssignment Cop

* Enabled SingleLineMethods Cop

* Enabled SpecialGlobalVars Cop

* Enabled VariableInterpolation Cop

* Enabled WhenThen Cop

* Enabled WhileUntilModifier Cop

* Enabled WordArray Cop

* Enabled IfUnlessModifier Cop

* Enabled GuardClause Cop
2019-03-15 18:33:54 -04:00
Mario See
d8709c0334 Implement open inbox for dev-connect (#1563) 2019-03-15 14:39:57 -04:00
Anna Buianova
96de5a4f60 Don't send new follower notification when followable is a tag #2041 (#2050)
* Enable djs to confirm follow spec fail

* Don't send new follower notification when followable is a tag
2019-03-13 08:16:20 -07:00
Ben Halpern
ea2eead9e3
Remove unnecessary save from follows controller (#1638) 2019-01-23 17:58:05 -05:00
rhymes
6553f08d94 Rubocop cleanups (#1415)
* Update rubocop-todo.yml with new violations

* Fix Layout/EmptyLine* rules

* Fix Layout/Indentation* rules

* Fix remaining Layout/* rules

* Fix Lint/DuplicateMethods by removing unused accessor

* Fix Lint/IneffectiveAccessModifier

* Fix Lint/MissingCopEnableDirective

* Re-run rubocop auto gen config

* Fix Layout/RescueEnsureAlignment

* Fix Naming/* rules

* Fix some RSpec/* rules

* Fix typos

* Fix RSpec/LetBeforeExamples

* Series should only be an attr_writer, not an attr_accessor

* Fix RSpec/InstanceVariable

* Fix RSpec/InstanceVariable

* Fix RSpec/RepeatedDescription and RSpec/RepeatedExample

* Fix Style/ClassAndModuleChildren

* Fix Style/ConditionalAssignment

* Fix some Style/* rules

* Trigger Travis CI build because failing tests are not failing locally

* Revert "Fix Style/ClassAndModuleChildren"

This reverts commit 1686801d8a1516ba1894f79e24401a20dea65f99.
2019-01-02 11:20:02 -05:00
Ben Halpern
651ab3ce35
Add point weights for tag follows (#1229)
* Add point weights for tag follows

* Adjust num articles to initially show up on home page

* Fix schema.rb

* Adjust follow policy spec

* Adjust dashboard styling for follow points form
2018-11-30 15:36:58 -05:00
Christine Yen
cff6b5d589 Add Honeycomb gem and initial instrumentation (#695)
* Add basic Honeycomb initializers

* Add some basic instrumentation, capture basic IDs

* Correctly alphabetize Gemfile, embed env in dataset names

* Actually reorder Gemfile because I can read

* Add custom tracing instrumentation to RssReader

* Improve timing/tracing info in RssReader

* Even make sure Errors show up in trace if possible

* Make sure we capture this as Rails traffic

* Swap in dev/test Libhoney::Clients as appropriate

* Move context-snagging bits into lib/instrumentation.rb

* Merging Gemfile lines seems to be my Achilles heel
2018-11-28 10:08:27 -05:00
Ben Halpern
115e52c748
Move follow and reaction aggregation into Notification model to avoid… (#1164)
* Move follow and reaction aggregation into Notification model to avoid re-compute

* Ugh. Fixing schema

* Update tests

* Skip some tests in notifications_spec
2018-11-20 15:00:21 -05:00
Andy Zhao
2db2dd1e5a WIP Refactor/notifications (#1131)
* Add new columns to notifications table

* Remove stream from notifications and add new methods

* Turn off moderation comment notifications

* Add notifiable_type index to migration

* Stop creation of Stream-based notification model instances

* Add notification model create hooks

* Add badge achievement notification creation hook

* Fix some specs

* Add missing @ symbol

* Fix for tests and rename a few things

* forgot to uncomment code sigh
2018-11-19 16:09:02 -05:00
Andy Zhao
cd9f6d9ada [Done] Add BDEFGI Policies and Specs (#487)
* Add comment for public controllers

* Add block policy and specs

* Add policy for authorizing dashboard

* Add follow policy and specs

* Refactor a tiny bit

* Prevent banned users from following anything

* Add a note for email sub controller about auth

* Add image upload policies

* Add policy for github repos

* Fix typo and use correct github repo variable

* Fix image uploader and use regular params

* Add authenticate_user before action back in

* Rename test

* Update slack bot message formatting and fix reported URL
2018-06-26 09:23:07 -04:00
Andy Zhao
263a74bcb6 Add more request specs (#460)
* Remove email blank onboarding redirect

* Add authorization specs for video upload

* Add registration spec

* Remove skip before actions for signup complete

* Use new param for abuse reports

* Remove else because it never runs

* Add more dashboard request specs

* Use let with no bang in case there are errors
2018-06-20 17:46:23 -04:00
Mac Siri
301c6080e3 Initial commit 2018-02-28 16:11:08 -05:00