[FIX] Lint (#2030)
This commit is contained in:
parent
a7641c19e2
commit
8445bafad6
|
@ -0,0 +1,24 @@
|
|||
import RocketChat from '../lib/rocketchat';
|
||||
|
||||
const canPost = async({ rid }) => {
|
||||
try {
|
||||
const permission = await RocketChat.hasPermission(['post-readonly'], rid);
|
||||
return permission && permission['post-readonly'];
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const isMuted = (room, user) => room && room.muted && room.muted.find && !!room.muted.find(m => m === user.username);
|
||||
|
||||
export const isReadOnly = async(room, user) => {
|
||||
if (room.archived) {
|
||||
return true;
|
||||
}
|
||||
const allowPost = await canPost(room);
|
||||
if (allowPost) {
|
||||
return false;
|
||||
}
|
||||
return (room && room.ro) || isMuted(room, user);
|
||||
};
|
|
@ -1,30 +1,6 @@
|
|||
import moment from 'moment';
|
||||
|
||||
import I18n from '../i18n';
|
||||
import RocketChat from '../lib/rocketchat';
|
||||
|
||||
export const canPost = async({ rid }) => {
|
||||
try {
|
||||
const permission = await RocketChat.hasPermission(['post-readonly'], rid);
|
||||
return permission && permission['post-readonly'];
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const isMuted = (room, user) => room && room.muted && room.muted.find && !!room.muted.find(m => m === user.username);
|
||||
|
||||
export const isReadOnly = async(room, user) => {
|
||||
if (room.archived) {
|
||||
return true;
|
||||
}
|
||||
const allowPost = await canPost(room);
|
||||
if (allowPost) {
|
||||
return false;
|
||||
}
|
||||
return (room && room.ro) || isMuted(room, user);
|
||||
};
|
||||
|
||||
export const isBlocked = (room) => {
|
||||
if (room) {
|
||||
|
|
|
@ -34,7 +34,8 @@ import { themes } from '../../constants/colors';
|
|||
import debounce from '../../utils/debounce';
|
||||
import ReactionsModal from '../../containers/ReactionsModal';
|
||||
import { LISTENER } from '../../containers/Toast';
|
||||
import { isReadOnly, isBlocked } from '../../utils/room';
|
||||
import { isBlocked } from '../../utils/room';
|
||||
import { isReadOnly } from '../../utils/isReadOnly';
|
||||
import { isIOS, isTablet } from '../../utils/deviceInfo';
|
||||
import { showErrorAlert } from '../../utils/info';
|
||||
import { withTheme } from '../../theme';
|
||||
|
|
|
@ -13,7 +13,8 @@ import styles from './styles';
|
|||
import TextInput from '../../containers/TextInput';
|
||||
import ActivityIndicator from '../../containers/ActivityIndicator';
|
||||
import { CustomHeaderButtons, Item } from '../../containers/HeaderButton';
|
||||
import { isReadOnly, isBlocked } from '../../utils/room';
|
||||
import { isBlocked } from '../../utils/room';
|
||||
import { isReadOnly } from '../../utils/isReadOnly';
|
||||
import { withTheme } from '../../theme';
|
||||
import { themedHeader } from '../../utils/navigation';
|
||||
|
||||
|
|
Loading…
Reference in New Issue