Commit graph

107 commits

Author SHA1 Message Date
Michael Kohl
8f5cfa2c0f
Drop profile columns from user (#10707)
* Prepare to drop profile columns from user

* Update code and factory

* Also remove unused constant

* Move validation from user to profile

* Remove Profiles::ExtractData service object

* Add more comments

* Simplify sameAs attribute generation

* Obey me machine, I am your master

* Fix condition order in guard clause

* Temporarily disable callback

* Fix specs

* Reduce usage of Profile#refresh_attributes!

* Remove leftover comment

* Handle social media links differently

* More spec fixes

* Fix specs for admin profile fields controller

* Fix specs after merge

* Fix remaining specs

* Update user show request spec

* Add comment for follow_hiring_tag

* Only save profile when user is valid

* Fix seeds.rb for profile fields

* Switch from before_save to after_save

* Undo unrelated formattin change

* Update spec/fixtures/files/profile_fields.csv

Co-authored-by: Molly Struve <mollylbs@gmail.com>

* Remove data update script and spec

* Fix spec

* Fix typo in comment

* Fix typo in comment

* Move article resave logic to service object

* Move profile field creation to before(:suite)

* Refactor error handling in Profiles::Update

* Fix Profiles::Update specs and refactor

* Temporarily disable spec

* Add ProfileValidator

* Clean up

* Move DB ready check into app/lib

* Refresh attributes after importing from CSV

* Fix specs

* Remove unused file

* A girl has no name. A profile neither.

* Fix specs

* Add responds_to? check

* Spec fix

* Add name to user fields in profile settings page

Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-12-03 08:14:38 +07:00
Thomas Bnt
3d8049697a
Edited URLs settings/ux to settings/customization (#11618) 2020-11-25 12:29:12 -05:00
Alexandre Ruban
ad747a271f
Fix rails db:seed error (#11272)
rails db:seed sometimes tries to create two 'vomit'
reactions on the same Article which is prohibited by the
validations on the Reaction model.
2020-11-04 10:55:05 -06:00
Jacob Herrington
8c3c4fb951
Explicitly set a resource type in seeds (#11050) 2020-10-26 12:27:51 +01:00
Jacob Herrington
4dde307a43
Fix NoMethodError for tag moderators channel (#11047)
* Fix NoMethodError for tag moderators channel

In development, it is possible to hit a NoMethodError when adding a tag
moderator because the "tag-moderator" slug is hard-coded.

This change helps mitigate that by adding a safe navigation operator. We
can always remove it if we decide to get rid of the hard-coded value.

Secondarily, it adds this channel to the seeds file, since we pretty
much expect it to exist.

* Move nested conditional
2020-10-23 21:02:54 -05:00
Ben Halpern
2d75d6d5ea
Fix missing registration data change (#11008)
* Fix missing registration acknowledgment

* Add backfill script and seeds adjustment

* Update lib/data_update_scripts/20201022161311_backfill_user_registrations_in_registrations_controller_path.rb

Co-authored-by: Molly Struve <mollylbs@gmail.com>

Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-10-22 19:21:03 -04:00
Jacob Herrington
c3a98db026
Make default admin a super admin (#10966) 2020-10-20 13:22:01 -05:00
Ridhwana
66b14fc0bf
[deploy] Dynamic frontend for the sidebar navigation Items (#10754)
* feat: configure the frontend for sidebar nav links

* chore: add a comment

* changes to the admin interface

* feat: move the temporary task to be in the rake tasks and use it in the dev seeds

* feat: use the task in the rake seeds

* refactor: reuse the form across two modals

* refactor: use the form partial

* feat: change the modal to be large

* fix: naming

* Update db/seeds.rb

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

* chore: make the file readable

* chore: removed the if else as the rake task was run on all forems + i sent out a message to new communities

* oops

* refactor: add a scope

* chore: oops removed this

* feat: add navigation links specs

* spec: fix two failing ones

Co-authored-by: Michael Kohl <me@citizen428.net>
2020-10-12 16:05:47 -04:00
Josh Puetz
c0272357c0
Add default admin to seeds file (#10620)
* Add default admin to seeds file

* Docs
2020-10-06 08:25:25 -05:00
Rafi
d570edcf07
Showing date in listing tile (#10217)
* Showing date in listing tile

* Displaying date in listing tile

1. Sending created_at in listing search API
2. Global util functions for short and long date formatting
3. New date util functions extend timestampToLocalDateTime
4. Converting div to time tag
5. Adding title attribute for date

* originally_published_at column

* Displaying originally_published_at date

* Fixing test in modal

* Fixing all listing test

* Fixing casing of dateTime

* Adding tests for originally_published_at

* Reverting to bumped_at

* Backfilling only published listing

* Removing ReIndexListingWithOriginallyPublishedAt
2020-09-21 10:14:26 +02:00
Lennart Melzer
b24c96010d
add image in podcast seeds in suggested way (#10371)
as described in [the carrierwave wiki](7041728c73)

otherwise seeding fails on Podcast validations:

```
ActiveRecord::RecordInvalid: Validation failed: Image Image has an unsupported type, Image can't be blank
/opt/apps/bundle/gems/activerecord-6.0.3.3/lib/active_record/validations.rb:80:in `raise_validation_error'
/opt/apps/bundle/gems/activerecord-6.0.3.3/lib/active_record/validations.rb:53:in `save!'
...
/opt/apps/forem/db/seeds.rb:267:in `block (2 levels) in <main>'
/opt/apps/forem/db/seeds.rb:266:in `each'
/opt/apps/forem/db/seeds.rb:266:in `block in <main>'
/opt/apps/forem/db/seeds.rb:19:in `create_if_none'
/opt/apps/forem/db/seeds.rb:206:in `<main>'
```
2020-09-18 09:06:37 +02:00
Jacob Herrington
00c75d0bb2
Add sponsorships to seed data (#10189) 2020-09-03 13:34:00 -04:00
Ben Halpern
dba151915b
[deploy] Allow initial user to sign up and configure app (#10073)
* Allow initial user to sign up and configure app

* Fix added value unneeded

* Make siteconfig public in tests

* Remove deprecated method and adjust seed default

* Add new controllers not to redirect for public

* Modify tests

* Edit test defaults

* Fix linting

* Add starter mode to seed file
2020-08-31 12:54:22 -04:00
Michael Kohl
6c2357af48
Fix seeds.rb (#10047) 2020-08-28 14:34:43 +02:00
Josh Puetz
d47d02f090
[deploy] Log in with Facebook (#9922)
* First draft of facebook auth

* Add Facebook welcome broadcast to seeds, data script

* Tests!

* Documentation

* Update docs with pictures

* User siteconfig/app config

* Adjust dropdown menu width to avoid wrap for Facebook button

* Add Facebook auth keys to SiteConfig properly

* Remove unnecessary VCR cassette

* Add omniauth facebook gem to vendor cache

* Use uid instead of email for nickname randomization

* Test fix, test for missing email in Facebook

* Update docs/backend/auth-facebook.md

Co-authored-by: Molly Struve <mollylbs@gmail.com>

* Typo fix!

* Don't default facebook auth settings to ApplicationConfig

Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-08-26 12:04:20 -04:00
Raphael Noriode
30b3592488
[deploy] Listing endorsements: models setup (#9841)
* create listing endorsement model and write test to validate it

* create the classified_listing_endorsements table

* create model associations with seed data and test validations

* modify test and create more seed date for endorsement

* modify the model naming, changed seed data to become radomized and updated the test file

* remove unnecessary function
2020-08-20 11:13:44 +02:00
Ben Halpern
6c71369df5
[deploy] Add community_name to site config (#9864)
* Add community_name to site config

* Fix a spec

* Remove SiteConfig from constants

* Change subjects to method

* Fix subjects method

* Fix linting
2020-08-19 14:54:40 -04:00
Michael Kohl
c2d23cfc4d
[deploy] Seed profile fields (#9605)
* Fix schema.rb

* Add service objects for base and link fields

* Add link fields to seeds

* Make placeholder a keyword argument

* Add work fields

* Add explanation column to profile fields

* Add coding fields

* Switch from inheritance to mixin

* Add email checkbox to base fields

* Add branding fields

* Add spec for ProfileFields::FieldDefinition

* Move migration back into correct location

* Rename column from explanation to description

* Rename attribute in mixin

* chore: rename from explanation to description

* Add ProfileFields::ImportFromCsv

* Simplify ProfileFields::ImportFromCsv

* Add comment about disabled cop to spec

* Add TODO comment to Rake task

* Document mixin

* Add groups to profile fields

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2020-08-05 10:11:30 -04:00
rhymes
5a2cae4fbb
Rubocop: enable and fix new Rails cops (#9537)
* Enable new Rails/* cops and use autocorrect on them

* Fixed Rails/PluckInWhere leftovers

* Fix Rails/DefaultScope

* Enable and fix Rails/PluckId

* Fix manual mistake with forcing autocorrection on Rails/PluckId

* Apply PR feedback to remove Rails/PluckId inline disables

* Apply PR feedback to get rid of Rails/PluckInWhere inline
2020-07-29 11:14:19 +02:00
Michael Kohl
f0c4197aab
Update seeds.rb with password confirmation (#9536) 2020-07-27 15:47:42 +02:00
rhymes
995f9f8679
Create Listings in seed file (#9351) 2020-07-16 12:08:11 -04:00
Alex
204fb51f14
[deploy] Remove path redirects (#9350)
* Remove path_redirect menu item

* Remove path_redirects_controller

* Remove path_redirect routes

* Remove PathRedirect model

* Remove internal views

* Remove path_redirects from seed file

* Remove PathRedirect factory

* Remove specs

* Migration to drop table and update schema
2020-07-16 09:35:42 -04:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Joe Doss
3ba1692eab
Don't seed in production when using db:prepare (#8754)
* We don't want to do devel seeding in production mode when using db:prepare. This
PR fixes that. We can also use seeds.rb to do production seeding for new Forems
in the future.

* Just return if in production instead of wrapping the entire file in an if statement.
2020-06-18 10:39:20 -04:00
Arit Amana
75e627fd2c
Include logic to ensure at least one no-role user (#8366) 2020-06-09 16:46:49 +02:00
rhymes
71d53873d1
Use Rails 6 new features in the code (#8342)
* Use pick instead of pluck first

* Use touch_all instead of update_all

* Use destroy_by instead of where.destroy_all

* Use scopes

* Fix db:seed:replant

* Remove ActiveSupport::Cache::RedisCacheStore expires_in cache
2020-06-08 16:06:29 -04:00
rhymes
4ab6d02d2f
Routine rubocop fixes (#8346)
* rubocop -a

* rubocop --auto-gen-config
2020-06-08 17:37:25 +02:00
rhymes
9215d04f08
[deploy] Routine Rubocop fixes (#8293)
* rubocop -a fixes

* rubocop --auto-gen-config
2020-06-05 18:46:10 -04:00
Alex
f7430ccd16
[deploy] Add path_redirects table and internal view (#8161)
* Create migrations

* Create PageRedirect model

* Refactor migration and add timestamps

* Add routes for internal/page_redirects

* Add index controller action and view

* Change background color of version in /internal

* Add page_redirect factory and index specs

* Fix specs

* Use ransack for search

* Alphabetize internal sidenav

* Rename spec

* Add edit view with destroy button

* Refactor page_redirect form partial

* Update error messages and fix redirect

* Small fixes and hookup new and create

* Specs FTW

* Fix migration, overridden --> source

* Add PageRedirect model specs

- Validate presence of status

* Update routes

* Code climate fixes

* Add old_slug_url and new_slug_url helper methods

* Prevent updating old_slug, refactor _form

* Add URLs to index view for slugs

* Better spec wording

* Change version to badges and add to edit view

* Update destroy response

* slug --> path 🙈

* Add PageRedirects to seed file

* Fix seed file

* ACTUALLY fix the seed file

* slug --> path in PageRedirect factory

* Remove bug fix from seeds file

* Move menu items to controller constant

* Update source type validation in model spec

* Rename page_redirect --> path_redirect

* Add AuditLog for admin create, destroy, and update

* Remove redundant index

* Cleanup old name of page_redirect

* Remove old model

* Update AuditLog to :internal

* Titleize search placeholder task in internal

* Add comment to explain MENU_ITEMS constant

* Add warning text on edit page about many updates

* Remove default and allow null on source

* Fix comment

* Add path_redirect validations and model specs

- Validate old_path != new_path
- Validate new_path isn't an existing redirect
2020-06-05 10:28:33 -04:00
Gagan Lokesh
3b188d349a
Fix database seeding issue (#8191) (#8192)
Error description: `NoMethodError: undefined method `limit' for nil:NilClass`
2020-05-31 13:30:33 -05:00
Michael Kohl
c3f3575dcf
Make DB seeding idempotent (#8153) 2020-05-29 10:21:00 -04:00
Julianna Tetreault
6cf177c3e4
Add download_app Welcome Notification (#8067)
* Add download_broadcast to generator.rb
  * Adds memoized download_broadcast method
  * Adds send_download_notification method
  * Adds send_download_notification to call method

* Add download_app to broadcasts.rb and seeds.rb
  * Adds download_app broadcast info and copy to factory
  * Adds download_app copy to seeds

* Add specs around #send_download_app_notification in generator_spec.rb

* Fix quotes around copy

* Remove extra space within copy
2020-05-27 08:14:47 -06:00
Michael Kohl
7f75f99560
[deploy] Rename classified listings (#7910)
* Change models and related files

* Update controllers and specs

* More renaming

* Seek and destroy, I mean search and replace

* Round up the stragglers

* Ground control to Major Travis...

* More fixes

* PR feedback

* Various fixes

* Rename view

* Fix list query builder

* Unify request specs

* Fix some API spec errors

* Fix remaining API specs

* Make spec conform to API

* Fix leftover problems

* Fix JS tests

* Fix column name in select

* Fix API specs

* Fix search specs

* Paging Mr. Travis
2020-05-27 13:35:09 +00:00
rhymes
b5ebf8f3dc
Routine rubocop fixes (#7743)
* Rubocop auto fixes

* Fix Capybara/VisibilityMatcher

* Regenerate todo
2020-05-08 19:38:06 +02:00
Julianna Tetreault
caccdba9ac
[deploy] Adjust GitHub and Twitter Connect Copy for Broadcasts (#7696)
* Adjust GitHub and Twitter connect copy for broadcasts
  *Removes robot copy from Twitter connect in seeds.rb and broadcasts.rb
  *Removes robot copy from GitHub connect in seeds.rb and broadcasts.rb

* Adjust quotation marks in copy

* Adjust apostrophe
2020-05-06 13:59:31 -04:00
Michael Kohl
fcd0639d2a
[deploy] Remove column and minor cleanup (#7642)
* Remove column and minor cleanup

* More cleanup

* Fix spec

* Remove category from select

* Wake up Travis

* No space for you
2020-05-03 11:52:03 -04:00
Mac Siri
c7e3971736
Remove ClassifiedListing.categories_available.keys in seed (#7648) 2020-05-01 13:01:49 -04:00
Mac Siri
a9cead5c91
Update bin/setup's db setup logic (#7644)
* Update bin/setup's db setup logic

* Remove duplicate seeds
2020-05-01 11:32:54 -04:00
Michael Kohl
46f94b135d
[deploy] Classified listings refactor part 3 (#7498)
* Ignore category column

* Move view oriented class methods to helper

* Start refactoring ClassifiedListingsToolkit

* Add attr_accessor instead of category

* Replace old category column with association

* More cleanup

* Trigger Travis

* Don't rename associations, category_slug -> category

* Indiana Kohl and the missing newline

* More refactoring and spec fixes

* Add dashboard for classified listing categories

* Remove TODO comment

Co-authored-by: rhymes <rhymesete@gmail.com>
2020-04-30 18:57:01 -04:00
Molly Struve
07fcd64182
remove article clear_index! from seeds file (#7570) 2020-04-28 11:28:52 -05:00
rhymes
6c3bd047a3
Create listings categories before listings in seed (#7512) 2020-04-26 19:35:13 +02:00
Molly Struve
a7e664fc9c
[deploy] Remove Algolia from User Model (#7454)
* Remove Algolia from User Model

* check banned on self for user

* fine have your redundant method

* remove a couple more unnecessary specs
2020-04-24 18:39:36 -04:00
Michael Kohl
9df68f3920
Use new classified listing categories (#7250)
* Add ClassifiedListingCategoryModel

* Add data update script for classified listing categories

* Refactor and fix specs

* Resolve conflict

* Incorporate PR feedback
2020-04-23 10:06:58 +07:00
rhymes
ee594a657f
Misc rubocop fixes (#7044)
* Fix violations

* rubocop autogen config
2020-04-03 11:48:47 -04:00
Vaidehi Joshi
a3d12e03a3
Add set_up_profile notification, check for active broadcasts (#7054) [deploy]
* Replace current onboarding notification with set_up_profile welcome notification

Also ensure that only "active" set_up_profile welcome notification is sent, and that "inactive" ones are ignored.

* Notify only if broadcast active, log error if broadcast not found

* Reports to Honeybadger if an active broadcast cannot be found

* Reorganize order of generator specs

* Ensure welcome_broadcast can be written to in spec

* Remove redundant spec
2020-04-02 15:56:29 -07:00
rhymes
2926f6be12
[deploy] Strengthen badge achievement code and fix badge email (#7000)
* Add badges and badge achievements to seeds

* Strengthen BadgeAchievement code and fix mailer bug

* Add indentation
2020-04-02 09:14:10 -04:00
Vaidehi Joshi
e23e69d4b2
Prompt users to ask a question/start a discussion (#7007) [deploy]
* Add a discuss/ask notification(s) to seeds + factories

* Add a start discussion/ask question welcome notification

* Add a scope for finding articles published by a user + with a certain tag.

* Some clean up/refactoring in the generator

* Reorganize welcome notification sending, add specs for discuss/ask notification
2020-04-01 11:57:50 -07:00
jituraj98
e2edf960dc
[deploy] Connect: move settings to sidecar iframe, improve invitations and remove experimental features (#6903)
* Feature 🚀 : Ability to delete messages in chat channels

- Sending message ID to frontend
- Deleting Message
- Use pusher to delete message realtime

* Minor Bug 🐞: Show message action only for current user

- User can delete or edit their own messages

* Test cases added

* Bug 🐞: Update message id for receiver

Message id was not sent to receiver by pusher

* Refactoring🛠: Message controller refactoring

* Test Cases📝 : Specs for Delete message added

* Feature 🚀 : Ability to edit messages

* Test Cases📝 : Specs for Edit message added

* Move channel settings to sidecar

* added spec for chat_channels_memberships_controller.rb (#6539)

* added spec for chat_channels_memberships_controller.rb

* simplified record not found error for membership

* error message formatting updated

* added error key in flash message

Co-authored-by: jitendra <jitendrarajpurohit@skynox.tech>

* Refining "Move sidecar to iframe" branch (#6634)

* added spec for chat_channels_memberships_controller.rb

* simplified record not found error for membership

* error message formatting updated

* added error key in flash message

* 🐞 Bug Fix: Open sidecar of clicking @all

* 🐞 Bug Fix: adding space after selecting the username from suggestion box

* added remove channel member functionality for moderators

* 🔩 Small Tweaks: Hover issue fixed

* 🐞 Bug Fix: Remove sidecar toggle on @all tag (for now)

* updated manually constructed urls with rails path helpers

* mod users cannot remove members of other channel

Co-authored-by: jitendra <jitendrarajpurohit@skynox.tech>

* 🚀 Finalising the connect group/channel feature.  (#6829)

* added spec for chat_channels_memberships_controller.rb

* simplified record not found error for membership

* error message formatting updated

* added error key in flash message

* 🐞 Bug Fix: Open sidecar of clicking @all

* 🐞 Bug Fix: adding space after selecting the username from suggestion box

* added remove channel member functionality for moderators

* 🔩 Small Tweaks: Hover issue fixed

* 🐞 Bug Fix: Remove sidecar toggle on @all tag (for now)

* updated manually constructed urls with rails path helpers

* mod users cannot remove members of other channel

* mod members can now invite user who have left the channel

* 🐞 Bug Fix: Ability to open sidecar on mention all properly

* Eslint Changes

* send email notification on inviting user feature added

* 🛠  Email design enhancements for channel invitation

* send invitation to mod user added from internal

* 🛠  Gif changes for Mod

* spec fixed

* inviter name issue fixed

* 🚀 Open sidecar when automatically if you use link from email

Co-authored-by: jitendra <jitendrarajpurohit@skynox.tech>

* review changes

* added spec for channel_invite_email

* Bug🐞: Design problem with sidecar after merge

* Bug🐞: Design problem with invitation alert box

* replaced instance variables with local variable

* Bug🐞: Wrong css classes fixed

* Bug🐞: Edit option bug

* yarn.lock file updated

* code review changes

* updated manually constructed urls with rails path helpers in spec

* user name url issue fix in invite email

* user url corrected

Co-authored-by: Sarthak Sharma <7lovesharma7@gmail.com>
Co-authored-by: benhalpern <bendhalpern@gmail.com>
2020-04-01 12:13:26 -04:00
Mac Siri
fc728af0cd
Prompt new users to customize their feed (#6979) 2020-03-31 17:32:11 -04:00
Vaidehi Joshi
28956d90a5
[deploy] Prompt new users to customize their experience (#6959)
* Rename find_broadcast to find_auth_broadcast

* Fix broken div rendering on /notifications tab

* Allow customize notification to be enqueued

* Add specs for customize welcome notification

Also clean up existing specs to match!

* Rename customization notification method for clarity

* Remove some redundant assertions in generator spec
2020-03-30 19:17:52 -04:00