-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for custom context path on Jira Server (#12)
- Loading branch information
1 parent
7922f6a
commit 092ad7a
Showing
12 changed files
with
177 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Client from "../Client"; | ||
import { CommonSettings, DefaultPluginSettings } from "../JiraPluginSettings"; | ||
import BaseJiraAction, { CountableResponse } from "./BaseJiraAction"; | ||
|
||
/** | ||
* Base class for actions that periodically pull data from Confluence. | ||
*/ | ||
export default abstract class BaseConfluenceAction<ResponseType extends CountableResponse<unknown>, SettingsType extends CommonSettings> extends BaseJiraAction<ResponseType, SettingsType> { | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected override getJiraClient(settings: DefaultPluginSettings): Client { | ||
this.validateSettings(settings); | ||
return super.getJiraClient(settings); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected override getUrl(settings: DefaultPluginSettings): string | null { | ||
this.validateSettings(settings); | ||
return super.getUrl(settings); | ||
} | ||
|
||
/** | ||
* Ensures that the settings have a proper context defined. | ||
* | ||
* When using JIRA Cloud, the context (as far as I know) is always `wiki`. | ||
* But when using JIRA Server, the context could be anything. | ||
* | ||
* @param settings - The current plugin settings. | ||
*/ | ||
private validateSettings(settings: DefaultPluginSettings) { | ||
// Ensure that the default context is set to `wiki` for JIRA Cloud. | ||
if (!this.isJiraServer(settings) && !settings.context) { | ||
settings.context = 'wiki'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.