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')}}
{{#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' };
}