Skip to content

feat: fix wrong message Unauthorized to connect to Openproject#1018

Draft
Ashim-Stha wants to merge 1 commit into
release/2.11from
unauthorized-bug
Draft

feat: fix wrong message Unauthorized to connect to Openproject#1018
Ashim-Stha wants to merge 1 commit into
release/2.11from
unauthorized-bug

Conversation

@Ashim-Stha
Copy link
Copy Markdown
Collaborator

@Ashim-Stha Ashim-Stha commented May 8, 2026

Description

Related Issue or Workpackage

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Updated CHANGELOG.md file

@Ashim-Stha Ashim-Stha self-assigned this May 8, 2026
Comment thread lib/Service/OpenProjectAPIService.php Outdated
@Ashim-Stha Ashim-Stha force-pushed the unauthorized-bug branch 4 times, most recently from b8f4510 to 7c574a1 Compare May 12, 2026 09:13
Comment thread lib/Service/OpenProjectAPIService.php Outdated
Comment thread lib/Service/OpenProjectAPIService.php Outdated
Comment thread lib/Service/OpenProjectAPIService.php Outdated
Comment thread lib/Service/OpenProjectAPIService.php
@Ashim-Stha Ashim-Stha force-pushed the unauthorized-bug branch 4 times, most recently from 9276eb7 to d6f2af2 Compare May 13, 2026 05:58
@Ashim-Stha Ashim-Stha requested a review from saw-jan May 13, 2026 06:06
Signed-off-by: Ashim Shrestha <ashimshrestha2384@gmail.com>
@github-actions
Copy link
Copy Markdown

JS Code Coverage

Coverage after merging unauthorized-bug into release/2.11 will be
91.03%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   adminSettings.js0%0%0%0%1, 1, 10–19, 2–9
   bootstrap.js0%0%0%0%1, 1, 10–12, 2–9
   dashboard.js0%0%0%0%1, 1, 10–19, 2–9
   fileActions.js0%0%0%0%1, 1, 10–19, 2, 20–23, 3–9
   personalSettings.js0%0%0%0%1, 1, 10–19, 2–9
   projectTab.js0%0%0%0%1, 1, 10–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50, 6–9
   reference.js0%0%0%0%1, 1, 10–19, 2, 20–29, 3, 30–39, 4, 40–45, 5–9
   utils.js85.71%62.50%66.67%87.41%12–14, 142–143, 15–20, 23–32
src/api
   endpoints.js100%100%100%100%
   settings.js64.71%100%0%73.33%10–11, 14–15
src/components
   AdminSettings.vue96.33%96.03%95.88%96.41%1005, 1008–1014, 1044–1045, 1049–1050, 1053–1054, 1058–1059, 1069–1074, 1146–1148, 1160–1163, 1176–1178, 1202–1205, 1239–1247, 1304–1306, 1341–1344, 1380–1382, 1402–1405, 724, 835–837, 992–994
   ErrorLabel.vue100%100%100%100%
   OAuthConnectButton.vue91.85%75%100%93.28%64–69, 72–76
   PersonalSettings.vue92.02%95.65%90%91.71%133–134, 144–149, 152–161
src/components/admin
   FieldValue.vue100%100%100%100%
   FormAuthMethod.vue98.12%96.88%100%98.12%222–224, 247–250
   FormHeading.vue100%100%100%100%
   FormOpenProjectHost.vue98.90%95%100%99.35%175–177, 287
   TermsOfServiceUnsigned.vue100%100%100%100%
   TextInput.vue100%100%100%100%
src/components/icons
   ClippyIcon.vue100%100%100%100%
   OpenProjectIcon.vue100%100%100%100%
src/components/settings
   CheckBox.vue100%100%100%100%
   ErrorNote.vue100%100%100%100%
   SettingsTitle.vue96.91%85.71%100%97.67%51–53
src/components/tab
   EmptyContent.vue96.45%80.95%100%98.24%102–105, 107–108, 97
   SearchInput.vue95.31%92.96%94.74%95.78%138–139, 192, 203–208, 267–269, 285–287, 291–296
   WorkPackage.vue86.25%73.17%93.33%87.62%107–116, 129–131, 142–146, 156–158, 176–182, 220, 220–225, 225, 225–236, 81–82
src/constants
   appID.js100%100%100%100%
   links.js100%100%100%100%
   messages.js100%100%100%100%
src/filesPlugin
   filesPlugin.js0%0%0%0%1, 1, 10, 100, 11–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–59, 6, 60–69, 7, 70–79, 8, 80–89, 9, 90–99
   filesPluginLessThan28.js0%0%0%0%1, 1, 10–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–59, 6, 60–69, 7, 70, 8–9
src/utils
   workpackageHelper.js93.80%93.10%88.89%94.24%100–102, 23–27, 54, 54–56, 97–99
src/views
   CreateWorkPackageModal.vue94.18%86.32%90.48%95.43%367–372, 375, 391, 508–511, 516–521, 526–531, 537–540, 543, 559, 559, 600–604, 614–616, 639–640, 648–650, 679–681, 703–705, 714–718
   Dashboard.vue92.96%92.86%82.61%93.77%120–125, 134, 144, 147, 158–160, 214–217, 220–221, 228–232, 67
   LinkMultipleFilesModal.vue99.14%97.56%100%99.32%157–159
   ProjectsTab.vue94.06%92.45%93.33%94.33%100–101, 107–109, 129, 140–141, 175–185, 234–236, 98–99

Comment on lines 1756 to 1759
if ($token) {
$this->logger->debug('Token has expired.', ['app' => $this->appName]);
$this->logger->debug('Refreshing access token.', ['app' => $this->appName]);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

clear user_name and user_id here

public function initUserInfo(string $userId, string $accessToken): array {
$savedUserId = $this->config->getUserValue($userId, Application::APP_ID, 'user_id');
$savedUsername = $this->config->getUserValue($userId, Application::APP_ID, 'user_name');
if (!$savedUserId || !$savedUsername) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (!$savedUserId || !$savedUsername) {
if ($savedUserId && $savedUsername) {
return;
}

$response = $this->rawRequest($accessToken, $openprojectUrl, '/users/me');
$info = json_decode($response->getBody(), true);
} catch (Exception $e) {
$this->logger->error('OpenProject error : ' . $e->getMessage());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$this->logger->error('OpenProject error : ' . $e->getMessage());
$this->logger->error('OpenProject error : ' . $e->getMessage(), ['app' => $this->appName]);

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.

2 participants