Commit graph

217 commits

Author SHA1 Message Date
Philip How
021213b841
Redo: New badge display logic on user's profile (#20944)
* new badge display

* fix cypress

* fix cypress

* Fit grid to exact number

* change point at which badges shown on profile header to 7

* remove  accidentally added objects

* remove  accidentally added objects

---------

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2024-05-10 17:45:18 -04:00
Mac Siri
3fccdcb507
Revert "New badge display logic on user's profile (#20936)" (#20941)
This reverts commit 149ae12dd1.
2024-05-09 15:44:18 -04:00
Philip How
149ae12dd1
New badge display logic on user's profile (#20936)
* new badge display

* fix cypress

* fix cypress

* Fit grid to exact number

* change point at which badges shown on profile header to 7

---------

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2024-05-09 11:48:07 -04:00
Anna Buianova
51316c747f
Comments count according to display rules in feed (#20753)
* Move calculating comments score from worker to a service

* Display displayed comments count in feed

* Recalculating displayed comments counts on article show (if needed)

* Rubocop fixes

* Fixed lambda
2024-03-28 12:12:05 +00:00
Anna Buianova
f572275c9d
Admin access for spammers profiles and articles (#20721)
* Allow admins to visit spammers profiles and articles pages

* Added spam label to user profile and articles

* Unset cache control headers when providing admin access to spam content

* Removed unused comment
2024-03-12 13:25:59 -04:00
Anna Buianova
288c9ed31f
Fix articles counts based on display rules (#20669)
* Comment counts for signed in users

* Adjust comments count for articles

* Fixed counts for signed out users, added specs for Comments::Count

* Fixed counts for signed out and added specs for Comments::Count

* Removed debug info from the view

* Removed separate count for signed out users

* Remove irrelevant specs

* Remove unused scope
2024-03-01 07:54:15 -05:00
Anna Buianova
a4d9b4f0d1
Hide low score comments on user profile (#20556) 2024-01-25 16:06:50 +00:00
Ben Halpern
b763ba8544
Allow pages to have subdirectories (#20549)
* Allow pages to have subdirectories

* Add locale text
2024-01-24 16:09:29 -05:00
Anna Buianova
947aaef7c1
Return 404 if user is a spammer (#20546) 2024-01-22 15:20:42 +00:00
Anna Buianova
9c7476db62
Make articles from a user with spam role inaccessible (direct access) (#20515)
* Make articles inaccessible if their author has spam role

* Improve specs a bit for showing spammer articles
2024-01-12 15:36:44 +00:00
Anna Buianova
473594f192
Match spam role with existing suspended actions (#20477)
* Started matching spam and suspended roles

* Match spam and suspended roles in most cases

* Fixed check_suspended for unauthenticated users
2023-12-27 20:12:50 +00:00
Anna Buianova
2d6b740940
Renamed DisplayAd model to Billboard (#19993)
* Renamed Resource Admin: DisplayAd to Billboard

* Renamed DisplayAd to Billboard

* Added a data update script for roles
2023-08-28 08:09:36 -04:00
Anna Buianova
058fd17b58
Renamed display_ad variables to billboard (#19851)
* Renamed display ad variables and constants

* Renamed display_ads associations

* Fixed variable name in display ads

* Renamed display_ads variables in views

* Fixed admin billboard view spec

* Fixed variable name in FilteredAdsQuery
2023-07-31 17:19:02 +03:00
Ridhwana
8c7d592b96
404 page for a suspended user with no published content (#19789)
* feat: update the logic in the user profile

* feat: remove use case for banished user

* feat: update has_no_content? to has_no_accessible_content? and write a test

* spec: write more tests

* refactor: rename variable

* refactor: small tweaks

---------

Co-authored-by: Philip How <philip.j.how@gmail.com>
2023-07-26 10:58:17 +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
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
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
Mac Siri
0813a0a322
Resolves false-positive UnsafeRedirectError (#19297) 2023-04-07 09:17:56 -04:00
Joshua Wehner
b812ca5955
(Really) Enable multiple reactions on #index (#19202) 2023-03-22 10:20:00 -04:00
Joshua Wehner
8086ef68ac
Fix bullet issue with includes commentable (#19145)
* Fix bullet issue with includes commentable

* Flatten view logic

* Restore user comment section logic (but bullet-friendly)

* Try fixing podcast_episode -> podcast

* Add test that would have caught the logic bug

* View specs need describe to specific the path

* Remove unnecessary _comments argument

* Ooops, missed saving this
2023-03-20 16:08:03 +01:00
Joshua Wehner
1374ab98e6
Ensure spam doesn't hit logged-out /latest (#19110)
* Ensure spam doesn't hit logged-out /latest

* Restore load-bearing constant

* Narrow selector avoids the new 'latest' banner

* Test scenario for signed-in low-score content

* Remove false-negative test

* Actual test for the logged-in scenario

* Signed-in users get poor quality content

* Feeds (RSS) use an entirely different query

* Pass @stories

* Update tests with new minimum score
2023-02-17 09:29:59 +01:00
Joshua Wehner
e63423573c
Misc/minor article fixes (#18846)
* Don't assume all requests are JSON

* Prevent nil error from optimized_image_tag (possible local data issue)

* Slug miss should 404, instead of Podcast not found

* Plain html rescue satisfies spec(s)
2022-12-13 15:15:09 +01:00
Joshua Wehner
201f4d998a
Try hiding low-quality comments (#18513)
* Try hiding low-quality comments

* Message indicating when negative comments are being hidden

* Adjust comment show count for logged-out visitors

* Remove unusued comments_to_show_count from article decorator

* Remove unusued comments_to_show_count from podcast episode decorator

* Add test for hidden negative comment

* Update spec/system/articles/user_visits_an_article_spec.rb

Co-authored-by: Fernando Valverde <fernando@fdo.cr>

* Don't create twice; do test logged-in and -out

* Comment caching needs to account for signed-in status

Co-authored-by: Fernando Valverde <fernando@fdo.cr>
2022-10-11 14:15:40 +02:00
Anna Buianova
455399bdba
Rubocop fixes (#18461)
* Rubocop fixes

* Fixed most Capybara/SpecificMatcher violations

* Moved flash notice texts to locales
2022-09-16 15:25:48 +03:00
VISHAL DEEPAK
b84fa1da08
Sort comments reopen (#18349)
* Sort comments in articles page

* Clickable area in sort comments article is now more approriate

* Comments subtitle is now responsive in articles page

* Consider comments sort order for cache in articles page

* On selecting sort option the refreshed page lands to comments section
2022-09-13 11:37:48 -06:00
Anna Buianova
ff76cdd3c5
Scheduling articles (#17939)
* Article query spec for scheduled articles

* Added scheduled article badge on the user dashboard

* Added published_at field to editor options

* Accept and validate published_at from editor

* Refactor published_at validation

* Allow 1-minute difference in published_at

* Notice on an unpublished article page

* Added specs for 'Click to edit' link on scheduled article preview page

* ContextNotification model

* Articles::Publish worker

* Added specs for articles publish worker

* Schedule publish articles worker

* Added tests to check for scheduled posts in feeds

* Don't allow managing scheduled articles

* Don't send notifications for scheduled articles

* Set published_at in Articles::Updater when publishing

* Published_at value in post options

* Pass timezone and set published_at accordingly

* Limit setting published_at to the future

* Readonly published_at for articles that were already published

* Chagning published_at format in editor v1 (start)

* Changed published_at format in frontmatter, specs

* Added specs for updating published_at from frontmatter

* Fixed accepting past published_at for articles published_from_feed

* Enabled published_at validation: don't allow updating published_at for already published articles

* Validate published_at on create

* Added a spec for updating published_at for exported articles

* Fixed specs related to creating articles with past published_at

* Fixed specs related to past published_at for articles

* Added a hack so that admins would be able to update published_at

* Switch button text schedule/publish when changin publishedAt

* Fixed saving published_at with timezone

* Added a feature flag for scheduling articles

* Default text in markdown editor depends on feature flag

* Enable article editor cache again

* Fixed the default value in the markdown editor

* Fix sitemaps spec

* Removed tooltip

* Fixed articles update specs

* Added missing locales

* Fixed article create specs

* Fixed spec

* Removed commented code

* Returned enabling extensions in the schema

* Returned accidentally deleted constraint

* Make articles query spec more stable

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Removed commented code

* Removed unused code

* A clearer policy

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Use StringInquirer for article current state

* Added a note and todo to articles factory past trait

* Remove duplicated PropType

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

* Refactor query in the Articles::PublishWorker

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

* Refactor articleForm.jsx

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

* Removed specs that are no longer relevant

* Removed useless onKeyUp on a hidden input

* Refactored articleForm

* Hide scheduling from post options when published_at is readonly

* Run sends notifications worker every 5 minutes instead of every minute

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-07-07 17:32:49 +03:00
Jeremy Friesen
a514ca39b8
Removing unused instance variable (#17414)
As I was looking into the implementation details of the `/t/:tag_name`
relevancy feed I noticed an instance variable that we do not need.

Below are the results of looking for the instance_variable
`@article_index` or a potential `article_index` local variable or method name.

```shell
❯ rg "@?article_index"
app/controllers/stories_controller.rb
28:    @article_index = true
131:    @article_index = true
162:    @organization_article_index = true

app/controllers/stories/tagged_articles_controller.rb
18:      @article_index = true

app/controllers/stories/articles_search_controller.rb
7:      @article_index = true

app/views/articles/_single_story.html.erb
26:          <% if story.cached_organization && !@organization_article_index %>
32:          <a href="/<%= story.cached_user.username %>" class="crayons-avatar <% if story.cached_organization && !@organization_article_index %> crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted <% else %> crayons-avatar--l <% end %> ">
79:            <% if story.cached_organization && !@organization_article_index %>
```
2022-04-25 10:43:21 -04:00
Jeremy Friesen
2fda726409
Revert "Added a way to sort comments on an article (#16686)" (#17093)
This reverts commit 1345334b33.
2022-04-04 08:36:34 -04:00
VISHAL DEEPAK
1345334b33
Added a way to sort comments on an article (#16686)
* Added a way to sort comments on an article

* Sorting of comments now uses crayons-dropwn. Some minor fixes as per comments on PR

* Add and fix test cases for sorting comments functionality

* Changes in code for sort comments.  Code  is more aligned with forem's conventions

* Added cyperss tests for sort comments on an article. Cleaned up code to better follow forem conventions

* Get fresh handle of triggerButton everytime clickOustideListener is clicked. Fix Cypress test cases to reflect the earlier.
2022-04-01 09:26:18 -05:00
Andy Zhao
841491c6ee
Redirect appended /moderate and /admin to the same page (admin member view) (#16779)
* Make /moderate and /admin the same redirect

* Fix view constraint limitations

* Update test
2022-03-03 19:40:03 -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
a65954107f
Refactoring to add helper method (#16064)
* Refactoring to add helper method

Prior to this commit, we made view level calls to service modules.  This
refactor provides convenience methods on the model.

Furthermore, it addresses a few Rubocop violations that "come along for
the ride."

* Ensuring cached entity squaks like User

* Fixing broken spec

* Fixing typo
2022-01-12 11:21:44 -05:00
Jeremy Friesen
973ff20eb8
Refactoring to consolidate logic (#15851)
* Refactoring to consolidate logic

Prior to this commit, two controllers had nearly identical chunks of
logic.  This refactor extracts the logic to a common and more canonical
location.

* Addressing rubocop's aggressive auto-fix

* Adding spat operator for pluck

* Renaming method for greater clarity
2021-12-29 11:08:04 -05:00
Jeremy Friesen
509b162cd7
Removing feed experiment for non-logged in user (#15733)
Related to #15240
2021-12-13 15:18:26 -05:00
Jeremy Friesen
5ee8764749
Factoring code to define Article.approved (#15600)
As I'm working on #15359 I wanted to favor using scopes over the raw
`where(approved: true)`.
2021-12-01 22:45:32 -05:00
Jeremy Friesen
c3b2883aa3
Instrumentation: adding tags to data tracing (#15517)
* Adding tags to data tracing

Prior to this commit, the feed's class was part of the resource.  That
resulted in a more opaque view of things.

With this change, we're adding tags to the view so we should have a
better sense of filtering.

* Bump for license/cla test
2021-11-29 14:53:56 -05:00
Jeremy Friesen
816e92e549
Configurable weighted feed strategy (#15240)
* AB Test for Feed Strategy

Adding the plumbing for performing AB Tests on the feed strategy.

You can add the environment variable `AB_TEST_SERVICE_FEED_STRATEGY` to
specify the field test to run.

For example, from the forem application home directory you can run the
following to force a strategy for all users:

```console
AB_TEST_SERVICE_FEED_STRATEGY=original bin/start
```

Forcing the strategy can significantly help with quality assurance testing.

* Adding configurable weighted feed strategy

I wrote about this exploration on [DEV.to][1].  This particular
implementation provides significant configuration options for A/B
testing.

At it's core this `Articles::Feeds::WeightedQueryStrategy` provides a
means to query articles that are relevant to the user.  The
configuration helps us test and refine those values.

Further more this implementation introduces the idea of some common
interfaces for feed strategies.  I'm not happy with the naming
convention but we can work to change that.

This even hints at a mechanism for administrators to configure.

Related to forem/rfcs#314, as I work towards understanding the feed
algorithm. And #15180

[1]:https://dev.to/jeremyf/practicing-postgresql-and-postulating-improvements-5m

* Renaming AbTestService to AbExperiment

I'm loath to end any production class's filename with "test".  I don't
want minitest or rspec coming along and attempting to "test" that file.
In addition, I find that Experiment better describes the concept.

Also, per conversations with Michael K, we favor nouns objects to go
in app/models and verb objects to go in app/services.  That's a great
separation.

* Factoring AbExperiment into a Controller concern

I wish this could be a stand-alone module but the implementation of
field test has cases that require controller context.

* Sanitizing configurable weighted strategy cases

* Minor refactoring of coding structure

* Renaming parameter for clarity

* Renaming variable to avoid confusion

Prior to the commit, `env` is a controller variable.  The injected `env`
variable didn't collide, but did create just a bit of confusion.

With this change, I'm trying to disentangle from that variable.

* Factoring AbExperiment away from mixin concern

Per discussion with Michael K, we both agree that we do not like
controller concern mixins.  They can quickly complicate the legibility
of any given codebase.

This refactor provides a common and simplified interface for a Plain Old
Ruby Object (PORO) that accounts for the implementation considerations
of the underlying "field_test" controller method.

* Adding Datadog.tracer.trace around feed actions

* Adding featured_article_factor

Prior to this commit, there was no consideration for how moderators
engage with an article.  This is a first nudge towards that effort.

* Removing spec

Add a spec that says yes or no we're feature testing something seems
fragile.  Namely, why are we wanting to assert that as a truism.

* Helping ensure we're "tracing" the same things

From the code comment:

> Hey, why the to_a you say?  Because the
> LargeForemExperimental has already done this.  But the
> weighted strategy has not.  I also don't want to alter the
> weighted query implementation as it returns a lovely
> ActiveRecord::Relation.  So this is a concession.

* Addressing parameters for tracing function

* For weight feed query only count positive tags

A user assigns explicit points to the tags that they do or do not want
to see.  This change treats the negative explicit_points as an indicator
that they don't want to see the tag.

* Adding weighted factor for privileged user reactions

* Updating comments to better clarify

* Adding additional constraint for published_at

* Updating documentation and adding logger

* Adding documentation concerning method call

* Upping logging level for experiments

See conversations in https://github.com/forem/forem/pull/15240

* Adding group by clauses to appease postgres configs

* Injecting relevant scoring method's joins

Prior to this commit, we included all of the joins regardless of the
scoring methods chosen.  With this commit, we only inject joins that are
used with the commit.

What this would allow us to do is to then have some pre-cooked scoring
methods but not turn them on.  Or to turn off the more expensive scoring
methods.

* Adding feature flag for feed strategy experiment
2021-11-29 10:46:56 -05:00
Jeremy Friesen
fbce226c08
Low Stakes Refactor of Feed class (#15180)
* Removing state change and unused method

Prior to this commit, the `@comment_weight` value would change.  This is
not ideal as depending on the call sequence, can notably change the
output.  I suspect this state change occurred so as to not alter an
underlying spec.

What this change does is remove the state change, removes a dead method,
renames a method (to the dead method name), and leverages
parameterization to better test a spec that was brittle based on
possible state changes.

I believe, from a logical stand point, that this change does not impact
the functionality nor the actual logic that is part of the production
call path.

* Marking methods as @api private

The goal is to highlight that we really shouldn't be calling these
outside of their contained class.  Ideally, I'd love to make them
private methods, but there are specs and would prefer to not use
`__send__` to change those specs.

This is a noop change.

* Renaming method to refelct returned param order

Prior to this commit the "default_home_feed_and_featured_story" returned
an array of `[featured_story, default_home_feed]`.  The method name and
the order of the returned values were misaligned.  This change helps
align the method name and the order of those returned values.

Note, methods such as `each_with_index` have an `element, index`
parameter order.
2021-10-26 09:57:33 -04:00
Ben Halpern
09fa66a03f
Fix and clean up podcast pages (#15004)
* Fix and clean up podcast pages

* Adjust tests

* Fix a test

* Fix missing i18n

* Fix tests

* Fix tests

* Fiddle with test

* Sure up css and tests

* Add featured as allowed param

* Fix a couple tests

* xit out test

* Update app/views/podcast_episodes/index.html.erb

* Update app/views/podcast_episodes/index.html.erb

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
2021-10-15 17:38:57 -04:00
ludwiczakpawel
096cf18b10
Article layout (#14753)
* style updates

* author and tools

* overflow hidden for avatars because geeeez

* font smoothing

* reverting little change

* specs

* preview

* css fix

* avatar fix'

* No longer eager load user profile when showing articles.

articles show view no longer needs user profile, as it no longer
renders the user profile preview.

* tags

* tags

* tags reverts

* typo

* dropping initializer for user cards previews on article page

* spec

* remove spec

* revert

* Update app/decorators/article_decorator.rb

Co-authored-by: Michael Kohl <me@citizen428.net>

* Update spec/requests/stories_show_spec.rb

Co-authored-by: Michael Kohl <me@citizen428.net>

* yoloing outline change on buttons because i couldn't see any visual difference

Co-authored-by: Dan Uber <dan@forem.com>
Co-authored-by: Michael Kohl <me@citizen428.net>
2021-09-30 19:08:06 +02:00
Michael Kohl
43a1c576a4
Move featured story to separate service (#14810)
* Move featured story to separate service

* Travis, wake up
2021-09-29 12:26:14 +07:00
Michael Kohl
c7ba9d81db
Clean up feed-related code (#14707)
* Start cleaning up feed code

* Move published_articles_by_tag to service

* Add timeframe and latest feed services

* fixup! Move published_articles_by_tag to service

* Move constant to correct location

* Fix spec
2021-09-17 09:23:32 +07:00
Michael Kohl
1b87cc7626
Profile generalization cleanup phase 2 (#14555)
* Remove ignored profile columns

* Update test.rb

* Remove dev profile fields CSV

* Fix first round of specs

* Add additional .includes

* More spec fixes

* Preload user in more locations

* Fix typo

* Spec/preloading fixes

* Specy McSpecFace

* Update e2e seeds

* Update e2e sees with correct display area

* Remove unused eager loading

* Update test.rb

* Add another entry to Bullet.safe_list

* Fix e2e seeds
2021-08-27 09:17:26 +07:00
Michael Kohl
1ebec4b67f
Remove hardcoded user profile fields (#14079)
* Remove duplicated work display from header

* Update work profile field handling

* Update DUS + spec

* Delegate more carefully

* Update delegation guard

* Adapt for removed delegation

* Undo accidental schema changes

* Fix seeds

* Remove accidentaly change

* Fix User#processed_website_url

* Update guard clause

* Update profile card content

* Add Organization#profile

* Be more conservative with profile fields

* Spec fixes round 1

* Fix typo

* Update spec

* Limit number of header fields and update card content

* Decorate correct model

* Update factory

* Update schema.rb

* Fix validation

* How bad could this possibly be?

* Pretty bad, nevermind

* Remove obsolete code

* Reset profile fields during test runs

* Move profile fields back to before(:suite)

* Spec fixes

* Remove accidentally re-added files

* More spec fixes

* Specs

* Change User#tag_keywords_for_search

* More spec fixes

* Add comment

* Undo accidental schema changes

* Attempt spec fix

* Remove fix attempt

* Fix e2e test

* Update spec

* Remove guard clause

* Remove hardcoded instances of education field

* WIP Access display_email_on_profile via User Settings

* Remove unused profile column

* WIP fix issues revealed by systems specs

* WIP fix issues revealed by services specs

* WIP Fix failing tests

* WIP Fix spec failures

* wip

* Move two attributes from controller to decorator

* Update comment

* More consistently use user.tag_line

Even before the profile changes we sometimes used the user.summary
attribute directly but used the user.tag_line method in other places.

* Remove education

* Add comment

* WIP

* Clean up mostly_work_with

* WIP

* Update work profile field handling

* More work-related changes

* Remove settings_only from display_area enum

* Remove quickfix from _metadata partial

* Remove special attributes

* Remove leftover spec

* Retrieve location from profile, not user

* Profile.special_attributes no longer exists

* Update specs

* More spec fixes

* Update UsersController

* Update UsersController and spec

* Fix e2e seeds

* Minor cleanup

* More e2e seed fixes

* Fix profile field CSV

* Fix e2e seeds

* Move one more attribute in e2e seeds

* Remove duplicate line

* Clear inputs before typing in them

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>
2021-08-18 11:44:53 +07:00
Khadija Sidhpuri
7567e77132
Extract search from StoriesController (#14377) 2021-07-30 10:55:00 -04:00
Michael Kohl
43ccdb31f1
Remove duplicated work display from header / profile work (#14210)
* Remove duplicated work display from header

* Update work profile field handling

* Update DUS + spec

* Delegate more carefully

* Update delegation guard

* Adapt for removed delegation

* Undo accidental schema changes

* Fix seeds

* Remove accidentaly change

* Fix User#processed_website_url

* Update guard clause

* Update profile card content

* Add Organization#profile

* Be more conservative with profile fields

* Spec fixes round 1

* Fix typo

* Update spec

* Limit number of header fields and update card content

* Decorate correct model

* Update factory

* Update schema.rb

* Fix validation

* How bad could this possibly be?

* Pretty bad, nevermind

* Remove obsolete code

* Reset profile fields during test runs

* Move profile fields back to before(:suite)

* Spec fixes

* Remove accidentally re-added files

* More spec fixes

* Specs

* Change User#tag_keywords_for_search

* More spec fixes

* Add comment

* Undo accidental schema changes

* Attempt spec fix

* Remove fix attempt

* Fix e2e test

* Update spec

* Remove guard clause

* Remove outdated guard clause

* Re-add validation

* Update header field validation

* Fix auto-complete fail
2021-07-30 12:28:40 +02:00
rhymes
28a75fe941
[15 min fix] Show pinned article to logged out users (#14219)
* Show pinned article to logged out users

* Check if pinned is defined

* Update app/views/articles/_single_story.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-07-15 08:09:38 -04:00
Molly Struve
e87dead7ad
Use new UserSetting and UserNotificationSettings and Ignore Related User Table Fields (#14121)
* schema file undelete description

* feat: v1 of the script

* Flesh out remaining enums under their categories

* complete UsersSettings data update script

* complete DUS for relevant attributes in users and profiles tables

* complete DUS for users_notification_settings

* alphabetize user_settings sql file

* safeguard against null values for "null: false" settings

* Set up actual UsersSettings DUS and specs files

* fix broken DUS script

* complete specs for UsersSetting DUS

* Address QA of specs

* complete specs for users_notification_settings DUS

* fix the typos (thanks Julianna!)

* begin implementation

* still building

* add missing attribute "email_membership_newsletter"

* complete sync code (except race condition for user profile)

* complete implementation, remains tests

* Address PR review and fix Travis fails

* remove superfluous Profile.new

* fix travis fails

* feat: update the users_notification_setting attributes from the user model

* feat: use the config fonts enums to display the fonts

* feat: loop through the keys

* fix profile = nil blowing up; add specs for notification_setting model

* remove unneeded spec

* remove feed validation until after sync code removed; fixes feed_import spec failures

* remove spec associated with feed_url validation in user_setting model

* fix failing spec 😅

* add TODO

* feat: set the user settings in the user controller  and use it in the customization form

* feat: move some update logic to the users settings controller thats being used from customization

* feat: show the updated values form the users_settingd and not the user instance

* Generalize redirect back to current tab

* still trying to reflect changed theme upon refresh

* customizations take effect on refresh

* remove 'with_feed' scope from user model

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

* start with takeover for fields previously in profiles table

* Takeover code for `publishing_from_rss` section in Settings (#13914)

* implement takeover code part 1

* implement takeover code

* fix feed fetch

* need rhymes help

* complete implementation; specs pending

* fix STUPID omission that caused so many headaches 😫

* implement profile fields pointing to users_settings 🎉

* run migrations

* implement inbox type & guidelines takeover code; specs pending (#13911)

* Point changes in notification settings to `users_notification_settings` table (#13910)

* implement takeover code; remains specs

* address PR feedback; remove related sync code

* address PR review feedback

* need help with routing and specs

* address pr review

* addressing pr review

* Treat implementation edge cases and omissions 😅

* fix uncommented comment

* fixing implementation cases

* address more PR review feedback

* fixing notifications use-cases

* refactor settings controller

* more pr review changes

* solving bugs

* fix broken onboarding

* handle eperience_level calls

* more fixes

* remove unneeded mappings

* add To-dos for quety updates

* remove done TODO

* purge done TODOs

* update notification_settings-related queries

* start fixing specs

* fixing specs

* fix notification and lrg_forem specs

* fixing broken specs

* still fixing

* fix line dif and remove reloads from user.rb

* run specs

* silence bullet and other fixes

* remove setting migration scripts and specs, fix more settings for specs

* handle missing user for article builder and fix notification specs

* fix some final controller specs and re-add incorrectly removed specs

* remove deprecated data update scripts and related workers, put travis back

* refactor admin tags mods controller, write/move specs for users notifications settings controller

* schema cleanup and other small refactors for consistency

* set field we can invalidate in spec via active record instead of at the db level

* remove I think an uneccessary hook call from subscribe_to_mailchimp_newsletter

* use bnefore_create to setup settings, please dont blow up the test suite

* mailchimp bot fix

* remove decorator in favor of single model method

Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
2021-07-08 09:31:34 -05:00
Alex
b02d43ca2d
Create DiscussionLocks (#13905)
* Create DiscussionLocks

* Fix specs

* Update nullify_blank_notes_and_reason

* Update before_validation call

* Updated DiscussionLockPolicy for clarity

* Move permitted_attributes to a constant

* Update route

* Apply suggestions from code review for frontend

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

* Add title tags

* Wrap unlock confirm in main element

* Wrap flash messages up in div

* Actually fix title tags

* Hide comment reply button when discussion is locked

* Add E2E tests

* Try to fix E2E tests

* Cypress...you work locally but not in CI...why!?

* PR feedback

* Update E2E tests

* More E2E updates 😭

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-10 11:04:33 -04:00
rhymes
99ddd31058
Pin posts to feed (#13807)
* Add SiteConfig.feed_pinned_article and validation

* Display pinned article at the top of feed

* Add (basic) functionality to pin/unpin post

* Admins can pin other users posts as well

* Hide the button if looking at the non pinned post

* Add pinned/unpinned snackbar message

* Rename SiteConfig usage to Settings::General

* Add pinned article to the Admin articles index

* Show the pin post button when there's no pinned article

* Move pinning to a separate controller

* Fix SiteConfig reference

* Hide PinController actions to unauthorized users

* PinnedArticlesController#show action and refactor some of the code

* Add Modal interaction

* Fix modal-pinned checkbox interaction

* Fixed pin/unpin post

* Add ArticleDecorator#pinned? specs

* Add PinnedArticlePolicy and PinnedArticlesController specs

* Add ability to actually pin an article from the admin after submit

* Add partial Cypress pin/unpin spec

* Fix pinned article and add basic Cypress interaction tests

* Add Crayons styling to modal

* Only render the pinned article on the default Feed page

* Use persisted?

* Add some comments

* Update app/javascript/articles/Article.jsx

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

* Update app/javascript/packs/homePageFeed.jsx

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

* Fix Cypress tests

* Update app/javascript/admin/controllers/article_controller.js

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

* Fix pinning in article show page

* Used PinnedArticle domain model

* Fix spec

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/articleFlows/pinArticle.spec.js

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

* Update cypress/integration/articleFlows/pinArticle.spec.js

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

* Update app/views/admin/articles/index.html.erb

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

* Fix merge woes

* Add missing article pin post flows

* Add missing admin article flows

* Add Unpin to Admin as well

* Add Audit::Log entries for pin/unpin actions

* Update app/controllers/stories/feeds_controller.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Do not rate limit in E2E tests

* Use .find instead of .filter

* Rename ArticleIdValidator to ExistingArticleIdValidator

* Treat draft and deleted articles the same

* Make sure posts can be pinned after the pinned article is unpublished or deleted

* Use .get directly

* Fix spec and fix PinnedArticlesController#show

* Strengthen pinArticle Cypress tests

* Add Cypress test heading guard

* Add another Cypress test heading guard

* Remove duplicate validator

* Try using the Tools: header instead of the article title

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-06-04 10:54:53 +02:00