Skip to content

New Watchlist

Saray Cabrera Padrón edited this page Feb 14, 2022 · 5 revisions

Data model

We can watch Projects, Packages and BsRequest.

polymorphic association Watchable

table watched_items

  • watchable_id
  • watchable_type
  • user_id

Project

has_many :watched_items, as: :watchable

Package

has_many :watched_items, as: :watchable

BsRequest

has_many :watched_items, as: :watchable

WatchedItem

  belongs_to :watchable, polymorphic: true
  belongs_to :user

Feature flag

We'll enable the new_watchlist feature flag. This enables the new watchlist to replace the old one, so the user can handle packages and requests apart from projects.

User Operations

Those operations should be behind the feature flag.

We could:

  • mark project as watched by someone
  • mark package as watched by someone
  • mark request as watched by someone
  • remove watched mark by someone from a project
  • remove watched mark by someone from a package
  • remove watched mark by someone from a request
  • list watched items by someone

Checking permissions to

  • anybody can create watched items for itself
  • nobody can create watched items for anyone else unless Admin
  • nobody can delete watched items from anybody's watchlist unless Admin
  • only the user can see its own watchlist

Steps

  • Create the migration
  • Update models
  • Create the feature flag
  • Implement the controllers to manage watchables
  • Implement the new UI behind the feature flag

UI Improvements

Bookmark a project, package or request by clicking on an icon near the project name, package name or request name (:fa-bookmark)

Clone this wiki locally