Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project overview
  • Repository
  • Issues 265
  • Merge Requests 28
  • CI / CD
  • Security & Compliance
  • Packages
  • Wiki
  • Snippets
  • Members
  • Collapse sidebar
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !436

Open
Opened 2 days ago by Ben Hayward@benhayward.ben
Report abuse

Surge token deletion on logout #1270

  • Overview 6
  • Commits 1
  • Pipelines 1
  • Changes 5
0/3 threads resolved

Summary

Closes #1270

Currently on the mobile app if you log into one account, then log out and into a different account, you will still receive push notifications for the first account.

This is because the Surge tokens (used for push notifications) that we use on the backend are not deleted on logout.

Steps

To hammer out with @brianhatchet and @msantang78. This is going to likely be tricky to test as we do not digest push notifications on the front-end, just the mobile app. This may require us using a manual build of the app and plugging it into the associated sandbox.

I would recommend testing sessions and account swapping/triggering notifications.

Regression Scope

Changes v Impact

  • api/v1/notifications - Simple change, setting the token on notif POST (from mobile).
  • Session\Manager - limited to the destroy functionality, so would affect anything that destroys a session (e.g. logging out).
  • Entities\User - added functions and an exported value, I don't foresee any issues here.
Request to merge fix/logout-surge-token-deletion-1270 into master
The source branch is 4 commits behind the target branch
Open in Web IDE
Pipeline #107889461 passed for 8954440c on fix/logout-surge-token-deletion-1270
          Requires 3 more approvals from Devs, Deployers, and QA.
          Emiliano Balbuena
          Emiliano Balbuena
          Brian Hatchet
          Brian Hatchet
          Rami Albatal
          Rami Albatal
          Martin Santangelo
          Martin Santangelo
          Guy Thouret
          Guy Thouret
          Ready to be merged automatically. Ask someone with write access to this repository to merge this request

          Deletes source branch

          • Ben Hayward @benhayward.ben added Squad::Yellow Status::Blocked scoped labels 2 days ago

            added scoped labels

          • Ben Hayward
            Ben Hayward @benhayward.ben · 2 days ago
            Developer

            Set to blocked pending chat with Brian and Martin.

          • Ben Hayward @benhayward.ben assigned to @brianhatchet, @msantang78, and @benhayward.ben 2 days ago

            assigned to @brianhatchet, @msantang78, and @benhayward.ben

          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet · 2 days ago
            Developer

            Testing on the app requires two things that we don't have.

            1. An ability to change the base url in the app for testing purposes.
            2. The ability to push notifications from the review sites.

            So, let's add some logging to show the push notifications going out so we can verify the body of the notification. Once we're sure the logging works, we'll verify it on staging

          • Brian Hatchet :speech_balloon: @brianhatchet added Status::BuddyReview scoped label and automatically removed Status::Blocked label 2 days ago

            added scoped label and automatically removed label

          • Ben Hayward
            Ben Hayward @benhayward.ben started a thread on the diff 1 day ago
            Controllers/api/v1/notifications.php
            146 146 'service' => $service,
            147 147 'token' => $passed_token
            148 148 ]);
            149
            150 Core\Session::getLoggedInUser()
            151 ->setSurgeToken($token)
            152 ->save();
            • Ben Hayward
              Ben Hayward @benhayward.ben · 1 day ago
              Developer

              We need to dump notification JSON do it in notifications file, but behind developer mode or feature flag.

            • Please register or sign in to reply
          • Emiliano Balbuena
            Emiliano Balbuena @edgebal started a thread on the diff 30 minutes ago
            Entities/User.php
            1227 1228 'toaster_notifications',
            1228 1229 'mode',
            1229 1230 'btc_address',
            1231 'surge_token',
            • Emiliano Balbuena
              Emiliano Balbuena @edgebal · 30 minutes ago
              Developer

              I'm not sure if we actually need to export surge_token. This will make it visible to the public.

            • Please register or sign in to reply
          • Emiliano Balbuena
            Emiliano Balbuena @edgebal started a thread on the diff 30 minutes ago
            Core/Sessions/Manager.php
            246 247 public function destroy($all = false)
            247 248 {
            248 249 if ($this->session) {
            249 $this->repository->delete($this->session, $all);
            250 if (!$this->user) {
            251 // If no user set grab from session.
            252 $this->user = new User($this->session->getLoggedInUser());
            • Emiliano Balbuena
              Emiliano Balbuena @edgebal · 30 minutes ago
              Developer

              Set the User constructor 2nd parameter to false to disable fetching cached entity.

              new User(..., false);
            • Please register or sign in to reply
          • Emiliano Balbuena
            Emiliano Balbuena @edgebal · 30 minutes ago
            Developer

            Added a couple of feedback items, @benhayward.ben

          • Emiliano Balbuena @edgebal added Status::Requires Changes scoped label and automatically removed Status::BuddyReview label 30 minutes ago

            added scoped label and automatically removed label

          Please register or sign in to reply
          3 Assignees
          Brian Hatchet's avatar
          Martin Santangelo's avatar
          Ben Hayward's avatar
          None
          Milestone
          None
          Time tracking
          No estimate or time spent
          2
          Labels
          Squad::Yellow Status::Requires Changes
          Lock merge request
          Unlocked
          10
          10 participants
          user avatar
          Emiliano Balbuena
          user avatar
          Brian Hatchet
          user avatar
          Rami Albatal
          user avatar
          Martin Santangelo
          user avatar
          Guy Thouret
          user avatar
          Mark Harding
          user avatar
          Marcelo Rivera
          Reference: minds/engine!436

          Now you can access the merge request navigation tabs at the top, where they’re easier to find.

          More information and share feedback