From 33c20a71aa25efae1cca78636737a3be2b4184fd Mon Sep 17 00:00:00 2001 From: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:42:50 +0530 Subject: [PATCH 1/3] Discord-RDS linking fix (#609) * chore: fix spelling mistake * Fixed condition check for linking account --- app/routes/discord.js | 2 +- app/templates/discord.hbs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/routes/discord.js b/app/routes/discord.js index 86579bca..1b126fa0 100644 --- a/app/routes/discord.js +++ b/app/routes/discord.js @@ -44,7 +44,7 @@ export default class DiscordRoute extends Route { toastNotificationTimeoutOptions ); - return { isTokenEpired: true }; + return { isTokenExpired: true }; } } catch (error) { this.toast.error(error.message, '', toastNotificationTimeoutOptions); diff --git a/app/templates/discord.hbs b/app/templates/discord.hbs index ef1fb62b..5fc79e27 100644 --- a/app/templates/discord.hbs +++ b/app/templates/discord.hbs @@ -10,7 +10,19 @@ {{else}} - {{#if (and @model.userData.discordId (eq @model.userData.roles.archived false))}} + {{! Added (eq @model.userData.roles.archived false) check for temporary, + For users who have left RDS before and are rejoining again now + This + TODO: 1. fix (eq @model.userData.roles.archived false) after deprecating archived role + 2. Remove this check and get a flow in place for users who had left RDS previously and are coming back now + 3. fix @model.userData.discordId check, which was removed, get a proper solution in place + }} + {{#if + (or + (eq @model.userData.roles.archived false) + (eq this.linkStatus 'linked') + ) + }}

Your Discord account has been successfully linked.

@@ -20,7 +32,7 @@

Something went wrong. Please try again.

- {{else}} + {{else if (eq this.linkStatus 'not-linked')}}
Date: Sun, 13 Oct 2024 11:45:46 +0530 Subject: [PATCH 2/3] fix the upload profile image button (#614) --- app/controllers/profile.js | 9 +++ app/styles/profile.css | 15 ++++- app/templates/profile.hbs | 23 +++++--- .../components/profile-field-test.js | 16 +++--- tests/integration/components/profile-test.js | 57 +++++++++++++++++++ tests/unit/routes/profile-test.js | 12 ++++ 6 files changed, 115 insertions(+), 17 deletions(-) create mode 100644 tests/integration/components/profile-test.js diff --git a/app/controllers/profile.js b/app/controllers/profile.js index ae3ec08d..d9bbd6f4 100644 --- a/app/controllers/profile.js +++ b/app/controllers/profile.js @@ -9,6 +9,15 @@ const BASE_URL = ENV.BASE_API_URL; export default class ProfileController extends Controller { @service toast; @service router; + get isDev() { + if ( + this.router.currentRoute && + this.router.currentRoute.queryParams.dev === 'true' + ) { + return this.router.currentRoute.queryParams.dev; + } + return false; + } get imageUploadUrl() { return `${BASE_URL}/users/picture`; } diff --git a/app/styles/profile.css b/app/styles/profile.css index f518b6b6..d2459cd7 100644 --- a/app/styles/profile.css +++ b/app/styles/profile.css @@ -40,7 +40,7 @@ } .profile-page-error { - text-align: center; + text-align: center; color: red; } @@ -91,6 +91,7 @@ aspect-ratio: 1; margin: auto; text-align: center; + position: relative; } .profile-form .user__pic { @@ -101,6 +102,18 @@ .edit-btn { padding: 0; + margin-top: 0.5rem; + color: var(--profile-edit-btn-clr); + font-weight: 600; + font-size: 1rem; +} + +.profile-edit-button { + padding: 0.5rem; + border-radius: 100%; + position: absolute; + top: 0.5rem; + right: 1rem; font-size: 1rem; margin-top: 0.5rem; color: var(--profile-edit-btn-clr); diff --git a/app/templates/profile.hbs b/app/templates/profile.hbs index 0132af9d..6fd68d70 100644 --- a/app/templates/profile.hbs +++ b/app/templates/profile.hbs @@ -9,16 +9,23 @@ user profile {{/if}} - + + {{#if this.isDev}} + + {{else}} + + {{/if}}
{{#if (get @model 'isDeveloper')}} diff --git a/tests/integration/components/profile-field-test.js b/tests/integration/components/profile-field-test.js index c1287b9a..17d62663 100644 --- a/tests/integration/components/profile-field-test.js +++ b/tests/integration/components/profile-field-test.js @@ -13,8 +13,8 @@ module('Integration | Component | profile-field', function (hooks) { }); await render(hbs` - `); @@ -35,8 +35,8 @@ module('Integration | Component | profile-field', function (hooks) { }); await render(hbs` - `); @@ -53,8 +53,8 @@ module('Integration | Component | profile-field', function (hooks) { }); await render(hbs` - @@ -80,8 +80,8 @@ module('Integration | Component | profile-field', function (hooks) { }); await render(hbs` - diff --git a/tests/integration/components/profile-test.js b/tests/integration/components/profile-test.js new file mode 100644 index 00000000..303a90b8 --- /dev/null +++ b/tests/integration/components/profile-test.js @@ -0,0 +1,57 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render, settled, click } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | profile-component', function (hooks) { + setupRenderingTest(hooks); + + test('button appearance based on isDev property', async function (assert) { + this.set('handleShowEditProfilePictureModal', () => { + this.set('showEditProfilePictureModal', true); + }); + + this.set('isDev', true); + + await render(hbs` + {{#if this.isDev}} + + {{else}} + + {{/if}} + `); + + assert.dom('[data-test-btn="edit"]').exists(); + assert.dom('[data-test-btn="edit"]').hasClass('profile-edit-button'); + + await click('[data-test-btn="edit"]'); + + assert.ok( + this.showEditProfilePictureModal, + 'Modal should be shown after clicking the button' + ); + + this.set('isDev', false); + + await settled(); + + assert.dom('[data-test-btn="edit"]').exists(); + assert.dom('[data-test-btn="edit"]').hasClass('edit-btn'); + assert.dom('[data-test-btn="edit"]').hasText('Update Picture'); + + await click('[data-test-btn="edit"]'); + + assert.ok( + this.showEditProfilePictureModal, + 'Modal should be shown after clicking the button' + ); + }); +}); diff --git a/tests/unit/routes/profile-test.js b/tests/unit/routes/profile-test.js index b6b51b9c..a1f4db1c 100644 --- a/tests/unit/routes/profile-test.js +++ b/tests/unit/routes/profile-test.js @@ -20,4 +20,16 @@ module('Unit | Route | profile', function (hooks) { assert.dom('[data-test-modal="image-upload"]').exists(); assert.dom('[data-test-btn="browse"]').exists(); }); + test('button appearance based on dev query param', async (assert) => { + await visit('/profile?dev=true'); + + assert.dom('[data-test-btn="edit"]').exists(); + assert.dom('[data-test-btn="edit"]').hasClass('profile-edit-button'); + + await visit('/profile?dev=false'); + + assert.dom('[data-test-btn="edit"]').exists(); + assert.dom('[data-test-btn="edit"]').hasClass('edit-btn'); + assert.dom('[data-test-btn="edit"]').hasText('Update Picture'); + }); }); From 1d28285eef738202488c6c394c9d85ec1cd89436 Mon Sep 17 00:00:00 2001 From: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com> Date: Sun, 13 Oct 2024 22:40:58 +0530 Subject: [PATCH 3/3] chore: remove unnecessary console.log statements (#616) --- app/helpers/convertDate.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/helpers/convertDate.js b/app/helpers/convertDate.js index e7e235c9..bbc84cef 100644 --- a/app/helpers/convertDate.js +++ b/app/helpers/convertDate.js @@ -10,8 +10,6 @@ const timeDifference = (timestamp, timeNow) => { const months = Math.floor(days / 30); const years = Math.floor(months / 12); - console.log({ timeInSec, mins, hours, days, months, years }); // Debug log - if (timeInSec < 1) { return { result: '', cycle: 'just now' }; }