-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26861 from software-mansion-labs/ts-migration/per…
…missions-lib [No QA] [TS migration] Migrate 'Permissions.js' lib to TypeScript
- Loading branch information
Showing
6 changed files
with
110 additions
and
158 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 was deleted.
Oops, something went wrong.
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,80 @@ | ||
import CONST from '../CONST'; | ||
import Beta from '../types/onyx/Beta'; | ||
|
||
function canUseAllBetas(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.ALL); | ||
} | ||
|
||
function canUseChronos(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.CHRONOS_IN_CASH) || canUseAllBetas(betas); | ||
} | ||
|
||
function canUsePayWithExpensify(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.PAY_WITH_EXPENSIFY) || canUseAllBetas(betas); | ||
} | ||
|
||
function canUseDefaultRooms(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas); | ||
} | ||
|
||
/** | ||
* IOU Send feature is temporarily disabled. | ||
*/ | ||
function canUseIOUSend(): boolean { | ||
return false; | ||
} | ||
|
||
function canUseWallet(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.BETA_EXPENSIFY_WALLET) || canUseAllBetas(betas); | ||
} | ||
|
||
function canUseCommentLinking(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.BETA_COMMENT_LINKING) || canUseAllBetas(betas); | ||
} | ||
|
||
/** | ||
* We're requiring you to be added to the policy rooms beta on dev, | ||
* since contributors have been reporting a number of false issues related to the feature being under development. | ||
* See https://expensify.slack.com/archives/C01GTK53T8Q/p1641921996319400?thread_ts=1641598356.166900&cid=C01GTK53T8Q | ||
*/ | ||
function canUsePolicyRooms(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.POLICY_ROOMS) || canUseAllBetas(betas); | ||
} | ||
|
||
function canUseTasks(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.TASKS) || canUseAllBetas(betas); | ||
} | ||
|
||
function canUseCustomStatus(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.CUSTOM_STATUS) || canUseAllBetas(betas); | ||
} | ||
|
||
function canUseCategories(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.NEW_DOT_CATEGORIES) || canUseAllBetas(betas); | ||
} | ||
|
||
function canUseTags(betas: Beta[]): boolean { | ||
return betas?.includes(CONST.BETAS.NEW_DOT_TAGS) || canUseAllBetas(betas); | ||
} | ||
|
||
/** | ||
* Link previews are temporarily disabled. | ||
*/ | ||
function canUseLinkPreviews(): boolean { | ||
return false; | ||
} | ||
|
||
export default { | ||
canUseChronos, | ||
canUsePayWithExpensify, | ||
canUseDefaultRooms, | ||
canUseIOUSend, | ||
canUseWallet, | ||
canUseCommentLinking, | ||
canUsePolicyRooms, | ||
canUseTasks, | ||
canUseCustomStatus, | ||
canUseCategories, | ||
canUseTags, | ||
canUseLinkPreviews, | ||
}; |
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
// Set up manual mocks for any Logging methods that are supposed hit the 'server', | ||
// this is needed because before, the Logging queue would get flushed while tests were running, | ||
// causing unexpected calls to HttpUtils.xhr() which would cause mock mismatches and flaky tests. | ||
export default { | ||
info: (message: string) => console.debug(`[info] ${message} (mocked)`), | ||
alert: (message: string) => console.debug(`[alert] ${message} (mocked)`), | ||
warn: (message: string) => console.debug(`[warn] ${message} (mocked)`), | ||
hmmm: (message: string) => console.debug(`[hmmm] ${message} (mocked)`), | ||
}; |
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