Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plug Batch info on Kitt callback and move back City on User to simplify validation logic. #325

Merged
merged 11 commits into from
Nov 17, 2023

Conversation

Aquaj
Copy link
Collaborator

@Aquaj Aquaj commented Nov 16, 2023

Summary of changes and context

closes #306

Rework structure of User/Batch/City to better use new Kitt OAuth schoolings info.

Sanity checks

  • Linters pass
  • Tests pass
  • Related GitHub issues are linked in the description

Comment on lines 12 to 15
<div class="flex flex-col gap-y-1 sm:flex-row sm:items-center sm:gap-x-3">
<%= f.label :batch_number, "Batch #" %>
<%= f.number_field :batch_number, value: @user.batch&.number, min: 1, class: "input", disabled: true %>
<%= f.number_field :batch_number, value: @user.batch&.number, min: 1, class: "input", disabled: @user.batch_id? %>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le batch devrait toujours etre disabled.
Soit les gens en ont un et ils peuvent pas changer
Soit ils en ont pas et ils peuvent pas s'en rajouter un.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soit ils en ont pas et ils peuvent pas s'en rajouter un.

J'avais pas cette info 😅 Je savais pas qu'on pouvait être "sans-batch", @pil0u on gère bien leurs points à eux ? Je me souviens plus de l'an dernier.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aquaj Oui, on peut récupérer un batch 0 ou nil sur l'OAuth, des profs extérieurs par exemple, j'évalue à ~1000 Alumnis concernés quand j'ai lancé le scraper, donc pas négligeable.

Mais oui, on n'a plus de scoring par batch, uniquement par squad et campus. Et pour le campus, comme ils choisissent eux-mêmes parmi une liste existante, ils sont pris en compte 👍

Comment on lines 89 to 97
{
accepted_coc: form_params[:accepted_coc],
aoc_id: form_params[:aoc_id],
entered_hardcore: form_params[:entered_hardcore],
username: form_params[:username],
batch_id: batch&.id,
batch_id: Batch.find_by(number: form_params[:batch_number])&.id,
city_id: form_params[:city_id],
referrer: User.find_by_referral_code(form_params[:referrer_code])
}.compact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment, the batch should never be updated by the user event if he has none.

Comment on lines 123 to 127
def city_must_match_batch
return unless batch&.city_id?

errors.add(:city_id, "must match batch city") if city_id != batch.city_id
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qu'ets ce qui se passe si tu as une city mais pas de batch ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le return unless batch&.city_id? ligne 124 fera que la validation sera juste pas appliquée.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sauf que tu as changé le model du Batch en disant que la city est optional.
Ca veut dire que tu pourrais avoir un batch avec un city_id nil qui casserait ensuite la validation non ?

Copy link
Collaborator Author

@Aquaj Aquaj Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour ça que le return checke aussi la présence de la city sur le Batch. Si le batch n'a pas de city_id on skippe aussi la validation.

C'est obsolète par contre si on permet pas de choisir son batch. L'optional sur Batch#city saute et on redeviendra juste return unless batch.present? ici pour la simplicité.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah oui j'avais zappé le &

app/models/user.rb Outdated Show resolved Hide resolved
app/models/user.rb Outdated Show resolved Hide resolved
Comment on lines 3 to 8
class Batch < ApplicationRecord
has_many :users, dependent: :nullify
belongs_to :city
belongs_to :city, optional: true

validates :number, numericality: { in: 1...(2**31), message: "should be between 1 and 2^31" }, allow_nil: true
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si on garde une reference a city sur le batch alors je comprend pas comment un batch pourrait se retrouver sans city

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'était surtout pour le système de choix de batch en cas de batch manquant sur Kitt. (Pcq du coup l'user choisirait un batch au choix, potentiellement un qu'on connaît pas et donc qui a pas de ville)

Mais si c'est pas nécessaire, je vais faire sauter ça.

@pil0u
Copy link
Owner

pil0u commented Nov 16, 2023

@Aquaj J'ai pas de commentaire sur le code en soi. Je me permets de faire une synthèse des specs parce que je crois que j'ai écrit ça nulle part 👀

  • À l'origine, on est parti sur un lien batch > city parce que le batch est la seule information qu'on récupérait via l'OAuth et qu'on sait par définition qu'un batch appartient à un campus donné. Ce lien, on l'établissait grâce au scraping.

  • Le scraping de tous les utilisateurs Kitt nous permettait aussi d'avoir une valeur du nombre d'Alumni par campus, par année, nécessaire à la formule des top_contributors (importante pour assurer une équité entre les villes). Ça on oublie pour le moment, au pire on utilisera les infos du CSV, au mieux Seb nous sortira un extract avec les valeurs.

  • Lorsqu'un utilisateur crée son compte sur la plateforme, il y a deux scénarii :

    1. L'utilisateur est un ancien étudiant (95%), il a au moins un batch (et une ville maintenant) qu'on récupère via l'OAuth, on peut donc lui assigner les 2. Aussi, on ne veut pas qu'il puisse changer ces valeurs-là, c'est assigné point final.

    2. L'utilisateur n'a pas de schooling (5%). Dans ce cas, osef du batch (rien dans l'app ne repose sur ça), donc on peut le laisser vide et qu'il n'ait pas le droit de le changer. Par contre, pour ces utilisateurs, on leur permet de choisir une ville. Cela dit, une fois qu'ils ont choisi (pick & save), c'est lock ils ne peuvent plus la changer.

  • Se pose la question du seed. Pour les batchs c'est dynamique et c'est OK. Pour les villes, le scraper l'a rendu dynamique mais je pense qu'il faudrait revenir à ce qu'on avait avant, c'est-à-dire une liste en dur dans le seed. Ça sert à une chose : permettre aux utilisateurs sans ville d'avoir une liste à partir de laquelle ils peuvent choisir. Je peux fournir cette liste, voire faire ça dans une autre PR.


class RemoveCityAndSizeFromBatches < ActiveRecord::Migration[7.1]
def change
safety_assured { remove_column :batches, :city_id, :bigint }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non on en a besoin. C'est elle qui force l'User à s'aligner sur son batch.

Copy link
Collaborator

@wJoenn wJoenn Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y a pas de choix, donc y a pas besoin de forcer.
Un user qui a un batch se connecte ?
alors le User model recupere le batch et la city. KittAuth peu pas se tromper, notre data viens du meme endroit donc si ils ont tord, on a tord.
Et comme il a deja les deux il pourras jamais changer.

Un user a pas de batch ?
Alors on a rien a verifier

Copy link
Collaborator Author

@Aquaj Aquaj Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense qu'il y a eu quiproquo: quand je dis "C'est elle qui force l'User à s'aligner sur son batch." ce que je veux dire c'est que c'est elle qui force l'User à s'aligner sur son batch dans notre modèle de donnée. Ça rend explicite une relation qui est seulement implicite ici.

"Y'a pas de choix donc pas besoin de forcer" c'est pas un bon argument. On est dans la couche de cohérence des données là, la présence ou absence de choix est dans la couche applicative.

C'est pas la mort de l'avoir enlevée, mais je trouve ça dommage.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourra peut-être rétablir 🫣

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai complètement oublié de passer sur les computers. Bien vu.

@wJoenn
Copy link
Collaborator

wJoenn commented Nov 16, 2023

@Aquaj j'ai retiré les validations parce qu'il y a une PR en cours pour ca
#318

Je la mettrai a jour une fois que celle ci est merge

db/seeds.rb Outdated Show resolved Hide resolved
spec/factories/users.rb Outdated Show resolved Hide resolved
u.username = auth.info.github_nickname
u.github_username = auth.info.github_nickname
u.batch_id = Batch.find_or_create_by(number: auth.info.last_batch_slug.to_i).id
u.batch = Batch.find_or_initialize_by(number: oldest_batch&.camp&.slug.to_i)
Copy link
Owner

@pil0u pil0u Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce que ça veut dire qu'on crée un batch 0 quoi qu'il arrive ? C'est mieux un batch 0 ou un batch nil ? cc @Aquaj

Edit : à choisir, nil ça évite d'afficher un vieux 0 tout moche dans le front

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non

validates :number, numericality: { in: 1...(2**31), message: "should be between 1 and 2^31" }, allow_nil: true

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sauf que nil.to_i == 0, il faudrait échapper avec .& non ?

Copy link
Collaborator

@wJoenn wJoenn Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La validation du Batch ne permet pas de creer un batch avec un number 0
Donc nil.to_i ne respectera pas la validation et le batch ne sera pas persisté du coup le batch sera nil

db/seeds.rb Outdated
{ name: "Toulouse", size: 20 },
{ name: "Tunis", size: 0 },
{ name: "Zurich", size: 64 },
{ name: "remote", size: 0 }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Désolé, j'avais pas vu que dans ma liste il y avait des 0... tu peux les enlever (je le ferai si t'es capot)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y avait pas de 0 dans ta liste.
J'ai fais City.all.map.sort_by en pensant que ca serait le meme resultat pour avoir une hash directement

@pil0u pil0u merged commit 3fe6919 into main Nov 17, 2023
@pil0u pil0u deleted the refacto/city-batch-user-relationship branch November 17, 2023 00:46
pil0u added a commit that referenced this pull request Nov 17, 2023
…fy validation logic. (#325)

* Plug Batch info on Kitt callback and move back City on User to simplify validation logic.

* Rubocop

* fix(users): revert some changes

* fix(users): undo everything from #289

* fix(users): use kitt city name instead of slug

* fix(users) last comments

* fix(users): remove empty city froms seed

* Wording + spacing

* Remove Testville

---------

Co-authored-by: Louis Ramos <louisramosdev@gmail.com>
Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>
pil0u added a commit that referenced this pull request Nov 17, 2023
* Update README.md (#305)

* Update README.md

* Update README.md

* Update README.md

* Spacing

* feat(users): Integrate a mapping between batch numbers and campuses from scrapped data (#289)

* Migrate fork branch

* batch_map.csv added to assets

* removed size from City model

* added size to Batch model

* added city reference to Batch

* added association between Batch and City + removed size from City model

* Added batch_map to seed + gave uid to test users

* added automatic city_id distribution on save to User model

* added some changes by Aquaj to seed.rb and users/edit.erb

* refactor

* Removed batch from permitted parameters

* Removed city foreign_key from users

* Removed ignored_columns size from city and city_id from user

* Moved batch_map.csv to db/static

* Add kitt scrapper script (python) to db/scripts

* fix(cities): restore size column for cities table

* feat(batch_map): rewrite scrapper in ruby and change data to be user scoped including batch year

* fix(batch_map): refactor seed to avoid doing multiple request to the DB for the same City

* feat(batch_map): move scrapper to a Job with CRON on Dec 1st

* Disabled city update for users that have a batch

* fix(batch_map): rubocop offense

* Rename batch_map csv to kill_alumni csv

* Remove batch_year column migration

* Refactor current_user.batch to explicit #blank? and #present? booleans

* Add vanity_name column to cities

* Fix typo in Scraper

* Rename KittScraperJob kwargs

* Refactor KittScrapperJob with CSV headers

* Fix users without batches not able to choose a city since remove city from User

* Fix tests

* Readd disabled confitions in UserFormComponent

* fix(users): moved user city validation inside model

* Fix CityPoints spec

* Fix CityScores spec

* Fix spacing

* Clarify condition on disabled city input

* Remove cron for Kitt scraper

* Set vanity name before create

* Handle case when user has no batch and picks a city

* Fix display of scraper pages

---------

Co-authored-by: Louis Ramos <wjoenn@gmail.com>
Co-authored-by: Jérémie <jeremie.bonal@gmail.com>
Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Bump sentry-rails and sentry-ruby (#309)

Bumps [sentry-rails](https://github.com/getsentry/sentry-ruby) and [sentry-ruby](https://github.com/getsentry/sentry-ruby). These dependencies needed to be updated together.

Updates `sentry-rails` from 5.12.0 to 5.13.0
- [Release notes](https://github.com/getsentry/sentry-ruby/releases)
- [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-ruby@5.12.0...5.13.0)

Updates `sentry-ruby` from 5.12.0 to 5.13.0
- [Release notes](https://github.com/getsentry/sentry-ruby/releases)
- [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-ruby@5.12.0...5.13.0)

---
updated-dependencies:
- dependency-name: sentry-rails
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: sentry-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Double quotes everywhere (#311)

* Double quotes everywhere

* Encore

* Re-add the staging environment in Sentry (#313)

* Fix GithubStar achievement by doing nothing if the response code of the request is not 200 (#310)

* fix(users) rename leftover 'city' to 'campus' (#315)

* feat(users): enabled cookie based referral system (#291)

* Add #referrer and #referrees to User

* Add referrer code form to setup

* Add referrement code to settings page

* fix erblint

* fix(users) minor templating changes

* fix(users): refactored User::by_referral_code

* fix(users): disable self-referral

* fix(users): add find_by_referral_code to Rubocop::Rails::DynamicFindBy::Whitelist

* fix(users): referrer from ternary to ... unless ...

* feat(users): enabled cookie based referral system

* fix(users): apply review comments

* feat(users): display referrees in settings (#314)

* feat(users): update referral sentence in settings

* feat(users): add links to referrees in settings

* feat(users): add links for squad users

* refactor(users): remove #to_raw_links

* refactor(users): sanitize to safe_join

* Add margin and pluralize the user(s)

* Rename referree to referee

* Add instance variable, for readability + fix quotes

---------

Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Auto-assign a leaderboard to new users (#286)

* Add Louis and Aurélie as contributors

* Add private_leaderboard column to Users

* Assign the emptiest leaderboard to every new user

* Add AOC_ROOMS env variable in tests to allow user update

* Move the AOC_ROOMS env variable for the test environment into a dedicated .env.test file

* Naming

* Add guard clause if for some reason the private leaderboard is already associated to the user

* Create an Admin page, with links to useful tools (#312)

* Add an impersonate User action for admins

* Add an admin page from which you can login, but accessible only for admins. It contains link to admin tools: blazer, good_job and the impersonation tool

* Add useful heroku commands

* Add the possibility to impersonate via uid or aoc_id

* Spacing

* Spacing

* Slightly adjust finding logic + add false-positive to brakeman ignore file

* Rollback formatting

---------

Co-authored-by: Jérémie <jeremie.bonal@gmail.com>

* Update the Code of Conduct (#321)

* Rename to code of conduct with all letters in the footer

* Improved the wording, emphasised the importance of being respectful, friendly and positive

* Bump good_job from 3.21.0 to 3.21.1 (#323)

Bumps [good_job](https://github.com/bensheldon/good_job) from 3.21.0 to 3.21.1.
- [Release notes](https://github.com/bensheldon/good_job/releases)
- [Changelog](https://github.com/bensheldon/good_job/blob/main/CHANGELOG.md)
- [Commits](bensheldon/good_job@v3.21.0...v3.21.1)

---
updated-dependencies:
- dependency-name: good_job
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Slack account link (#316)

* Better handling of failures during omniauth signin

Fix nesting so custom defined `failure` actually exists on the
controller
+ rely on Devise `failure_message` which is better
implemented than our own error-message extractor
+ extract part of thelogic to  small private method that'll help us later

* Add Slack OpenID Omniauth strategy

* Add button to link account

* Add unlinking mechanism

* Rubocop

* Add spec for unlinking

* Add back controllers: config bc it's actually needed to set some internal attributes of OmniAuth

* Create helper to handle complex error-mocking logic for OmniAuth

* Add spec for omniauth slack callback

* Rubocop

* ERB Lint

* Rubocop Again

* Consistent notice before redirect

* Spacing

* Reorder methods and add slack_deep_link

* Add Font Awesome Slack icon (and remove the unused Plus)

* Remove margin from component

* Adjust style for the Slack integration section

* Slightly adjust the spacing in squad settings

* Move the Slack settings below the Squad settings

* Add handling of failed updates

* Add storage for Slack access-token as we might need it.

* Use fail_auth in #kitt Omniauth callback too.

* Rubocop

* Add Slack credentials and active record encryption key set in production

---------

Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* fix(campus): rename view files and template references of city to campus (#324)

* fix(campus): rename view files and template references of city to campus

* fix(campus): tests

* feat(campus): further migrate cities to campuses

* fix(campus): update campus route path

* Fix the user show

* Show and order cities dropdown by vanity_name

* Form label

* Update campus show

* CityRowComponent -> CampusRowComponent

---------

Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Plug Batch info on Kitt callback and move back City on User to simplify validation logic. (#325)

* Plug Batch info on Kitt callback and move back City on User to simplify validation logic.

* Rubocop

* fix(users): revert some changes

* fix(users): undo everything from #289

* fix(users): use kitt city name instead of slug

* fix(users) last comments

* fix(users): remove empty city froms seed

* Wording + spacing

* Remove Testville

---------

Co-authored-by: Louis Ramos <louisramosdev@gmail.com>
Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Refresh the FAQ (#326)

* Update the wording of the existing FAQ

* Remove data notice in settings, it's already in the FAQ

* Reorder questions

* Remove horrendous spaces

* Remove CSV

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Louis Ramos <75388869+wJoenn@users.noreply.github.com>
Co-authored-by: Louis Ramos <wjoenn@gmail.com>
Co-authored-by: Jérémie <jeremie.bonal@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Louis Ramos <louisramosdev@gmail.com>
Aquaj added a commit that referenced this pull request Nov 17, 2023
* Update README.md (#305)

* Update README.md

* Update README.md

* Update README.md

* Spacing

* feat(users): Integrate a mapping between batch numbers and campuses from scrapped data (#289)

* Migrate fork branch

* batch_map.csv added to assets

* removed size from City model

* added size to Batch model

* added city reference to Batch

* added association between Batch and City + removed size from City model

* Added batch_map to seed + gave uid to test users

* added automatic city_id distribution on save to User model

* added some changes by Aquaj to seed.rb and users/edit.erb

* refactor

* Removed batch from permitted parameters

* Removed city foreign_key from users

* Removed ignored_columns size from city and city_id from user

* Moved batch_map.csv to db/static

* Add kitt scrapper script (python) to db/scripts

* fix(cities): restore size column for cities table

* feat(batch_map): rewrite scrapper in ruby and change data to be user scoped including batch year

* fix(batch_map): refactor seed to avoid doing multiple request to the DB for the same City

* feat(batch_map): move scrapper to a Job with CRON on Dec 1st

* Disabled city update for users that have a batch

* fix(batch_map): rubocop offense

* Rename batch_map csv to kill_alumni csv

* Remove batch_year column migration

* Refactor current_user.batch to explicit #blank? and #present? booleans

* Add vanity_name column to cities

* Fix typo in Scraper

* Rename KittScraperJob kwargs

* Refactor KittScrapperJob with CSV headers

* Fix users without batches not able to choose a city since remove city from User

* Fix tests

* Readd disabled confitions in UserFormComponent

* fix(users): moved user city validation inside model

* Fix CityPoints spec

* Fix CityScores spec

* Fix spacing

* Clarify condition on disabled city input

* Remove cron for Kitt scraper

* Set vanity name before create

* Handle case when user has no batch and picks a city

* Fix display of scraper pages

---------

Co-authored-by: Louis Ramos <wjoenn@gmail.com>
Co-authored-by: Jérémie <jeremie.bonal@gmail.com>
Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Bump sentry-rails and sentry-ruby (#309)

Bumps [sentry-rails](https://github.com/getsentry/sentry-ruby) and [sentry-ruby](https://github.com/getsentry/sentry-ruby). These dependencies needed to be updated together.

Updates `sentry-rails` from 5.12.0 to 5.13.0
- [Release notes](https://github.com/getsentry/sentry-ruby/releases)
- [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-ruby@5.12.0...5.13.0)

Updates `sentry-ruby` from 5.12.0 to 5.13.0
- [Release notes](https://github.com/getsentry/sentry-ruby/releases)
- [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-ruby@5.12.0...5.13.0)

---
updated-dependencies:
- dependency-name: sentry-rails
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: sentry-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Double quotes everywhere (#311)

* Double quotes everywhere

* Encore

* Re-add the staging environment in Sentry (#313)

* Fix GithubStar achievement by doing nothing if the response code of the request is not 200 (#310)

* fix(users) rename leftover 'city' to 'campus' (#315)

* feat(users): enabled cookie based referral system (#291)

* Add #referrer and #referrees to User

* Add referrer code form to setup

* Add referrement code to settings page

* fix erblint

* fix(users) minor templating changes

* fix(users): refactored User::by_referral_code

* fix(users): disable self-referral

* fix(users): add find_by_referral_code to Rubocop::Rails::DynamicFindBy::Whitelist

* fix(users): referrer from ternary to ... unless ...

* feat(users): enabled cookie based referral system

* fix(users): apply review comments

* feat(users): display referrees in settings (#314)

* feat(users): update referral sentence in settings

* feat(users): add links to referrees in settings

* feat(users): add links for squad users

* refactor(users): remove #to_raw_links

* refactor(users): sanitize to safe_join

* Add margin and pluralize the user(s)

* Rename referree to referee

* Add instance variable, for readability + fix quotes

---------

Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Auto-assign a leaderboard to new users (#286)

* Add Louis and Aurélie as contributors

* Add private_leaderboard column to Users

* Assign the emptiest leaderboard to every new user

* Add AOC_ROOMS env variable in tests to allow user update

* Move the AOC_ROOMS env variable for the test environment into a dedicated .env.test file

* Naming

* Add guard clause if for some reason the private leaderboard is already associated to the user

* Create an Admin page, with links to useful tools (#312)

* Add an impersonate User action for admins

* Add an admin page from which you can login, but accessible only for admins. It contains link to admin tools: blazer, good_job and the impersonation tool

* Add useful heroku commands

* Add the possibility to impersonate via uid or aoc_id

* Spacing

* Spacing

* Slightly adjust finding logic + add false-positive to brakeman ignore file

* Rollback formatting

---------

Co-authored-by: Jérémie <jeremie.bonal@gmail.com>

* Update the Code of Conduct (#321)

* Rename to code of conduct with all letters in the footer

* Improved the wording, emphasised the importance of being respectful, friendly and positive

* Bump good_job from 3.21.0 to 3.21.1 (#323)

Bumps [good_job](https://github.com/bensheldon/good_job) from 3.21.0 to 3.21.1.
- [Release notes](https://github.com/bensheldon/good_job/releases)
- [Changelog](https://github.com/bensheldon/good_job/blob/main/CHANGELOG.md)
- [Commits](bensheldon/good_job@v3.21.0...v3.21.1)

---
updated-dependencies:
- dependency-name: good_job
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Slack account link (#316)

* Better handling of failures during omniauth signin

Fix nesting so custom defined `failure` actually exists on the
controller
+ rely on Devise `failure_message` which is better
implemented than our own error-message extractor
+ extract part of thelogic to  small private method that'll help us later

* Add Slack OpenID Omniauth strategy

* Add button to link account

* Add unlinking mechanism

* Rubocop

* Add spec for unlinking

* Add back controllers: config bc it's actually needed to set some internal attributes of OmniAuth

* Create helper to handle complex error-mocking logic for OmniAuth

* Add spec for omniauth slack callback

* Rubocop

* ERB Lint

* Rubocop Again

* Consistent notice before redirect

* Spacing

* Reorder methods and add slack_deep_link

* Add Font Awesome Slack icon (and remove the unused Plus)

* Remove margin from component

* Adjust style for the Slack integration section

* Slightly adjust the spacing in squad settings

* Move the Slack settings below the Squad settings

* Add handling of failed updates

* Add storage for Slack access-token as we might need it.

* Use fail_auth in #kitt Omniauth callback too.

* Rubocop

* Add Slack credentials and active record encryption key set in production

---------

Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* fix(campus): rename view files and template references of city to campus (#324)

* fix(campus): rename view files and template references of city to campus

* fix(campus): tests

* feat(campus): further migrate cities to campuses

* fix(campus): update campus route path

* Fix the user show

* Show and order cities dropdown by vanity_name

* Form label

* Update campus show

* CityRowComponent -> CampusRowComponent

---------

Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Plug Batch info on Kitt callback and move back City on User to simplify validation logic. (#325)

* Plug Batch info on Kitt callback and move back City on User to simplify validation logic.

* Rubocop

* fix(users): revert some changes

* fix(users): undo everything from #289

* fix(users): use kitt city name instead of slug

* fix(users) last comments

* fix(users): remove empty city froms seed

* Wording + spacing

* Remove Testville

---------

Co-authored-by: Louis Ramos <louisramosdev@gmail.com>
Co-authored-by: pil0u <8350914+pil0u@users.noreply.github.com>

* Refresh the FAQ (#326)

* Update the wording of the existing FAQ

* Remove data notice in settings, it's already in the FAQ

* Reorder questions

* Remove horrendous spaces

* Remove CSV

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Louis Ramos <75388869+wJoenn@users.noreply.github.com>
Co-authored-by: Louis Ramos <wjoenn@gmail.com>
Co-authored-by: Jérémie <jeremie.bonal@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Louis Ramos <louisramosdev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendre dynamique les tailles de batchs et de villes ?
3 participants