Minor tweaks
This commit is contained in:
parent
a245af6c1c
commit
16fd57527a
|
@ -38,7 +38,6 @@ export const INQUIRY = createRequestTypes('INQUIRY', [...defaultTypes, 'SET_ENAB
|
|||
export const APP = createRequestTypes('APP', ['START', 'READY', 'INIT', 'INIT_LOCAL_SETTINGS', 'SET_MASTER_DETAIL']);
|
||||
export const MESSAGES = createRequestTypes('MESSAGES', ['REPLY_BROADCAST']);
|
||||
export const CREATE_CHANNEL = createRequestTypes('CREATE_CHANNEL', [...defaultTypes]);
|
||||
export const CREATE_TEAM = createRequestTypes('CREATE_TEAM', [...defaultTypes]);
|
||||
export const CREATE_DISCUSSION = createRequestTypes('CREATE_DISCUSSION', [...defaultTypes]);
|
||||
export const SELECTED_USERS = createRequestTypes('SELECTED_USERS', ['ADD_USER', 'REMOVE_USER', 'RESET', 'SET_LOADING']);
|
||||
export const SERVER = createRequestTypes('SERVER', [
|
||||
|
|
|
@ -715,5 +715,6 @@
|
|||
"Private_Team": "Private Team",
|
||||
"Read_Only_Team": "Read Only Team",
|
||||
"Broadcast_Team": "Broadcast Team",
|
||||
"creating_team" : "creating team"
|
||||
"creating_team" : "creating team",
|
||||
"team-name-already-exists": "A team with that name already exists"
|
||||
}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
import log from '../../utils/log';
|
||||
import updateMessages from './updateMessages';
|
||||
|
||||
async function load({ rid: roomId, latest, t }) {
|
||||
let params = { roomId, count: 50 };
|
||||
async function load({
|
||||
rid: roomId, latest, t, team
|
||||
}) {
|
||||
let params = { roomId: roomId || team.roomId, count: 50 };
|
||||
let apiType;
|
||||
if (latest) {
|
||||
params = { ...params, latest: new Date(latest).toISOString() };
|
||||
}
|
||||
|
||||
const apiType = this.roomTypeToApiType(t);
|
||||
if (team.type) {
|
||||
apiType = this.roomTypeToApiType('p');
|
||||
} else {
|
||||
apiType = this.roomTypeToApiType(t);
|
||||
}
|
||||
if (!apiType) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ const handleRequest = function* handleRequest({ data }) {
|
|||
const subCollection = db.get('subscriptions');
|
||||
yield db.action(async() => {
|
||||
await subCollection.create((s) => {
|
||||
s._raw = sanitizedRaw({ id: sub.rid }, subCollection.schema);
|
||||
s._raw = sanitizedRaw({ id: sub.team ? sub.team.roomId : sub.rid }, subCollection.schema);
|
||||
Object.assign(s, sub);
|
||||
});
|
||||
});
|
||||
|
@ -94,16 +94,12 @@ const handleSuccess = function* handleSuccess({ data }) {
|
|||
if (isMasterDetail) {
|
||||
Navigation.navigate('DrawerNavigator');
|
||||
}
|
||||
if (data.team) {
|
||||
goRoom({ item: data.team, isMasterDetail });
|
||||
} else {
|
||||
goRoom({ item: data, isMasterDetail });
|
||||
}
|
||||
goRoom({ item: data.team ? data.team : data, isMasterDetail });
|
||||
};
|
||||
|
||||
const handleFailure = function handleFailure({ err }) {
|
||||
setTimeout(() => {
|
||||
const msg = err.reason || I18n.t('There_was_an_error_while_action', { action: I18n.t('creating_channel') });
|
||||
const msg = err.data ? I18n.t(err.data.error) : err.reason || I18n.t('There_was_an_error_while_action', { action: I18n.t('creating_channel') });
|
||||
showErrorAlert(msg);
|
||||
}, 300);
|
||||
};
|
||||
|
|
|
@ -7,19 +7,11 @@ const navigate = ({ item, isMasterDetail, ...props }) => {
|
|||
if (isMasterDetail) {
|
||||
navigationMethod = Navigation.replace;
|
||||
}
|
||||
console.log({ item });
|
||||
if (item.roomId) {
|
||||
|
||||
navigationMethod('RoomView', {
|
||||
rid: item.roomId || item.rid,
|
||||
name: RocketChat.getRoomTitle(item),
|
||||
roomUserId: RocketChat.getUidDirectMessage(item),
|
||||
...props
|
||||
});
|
||||
} else {
|
||||
navigationMethod('RoomView', {
|
||||
rid: item.rid,
|
||||
name: RocketChat.getRoomTitle(item),
|
||||
t: item.t,
|
||||
t: item.type ? 'p' : item.t,
|
||||
prid: item.prid,
|
||||
room: item,
|
||||
search: item.search,
|
||||
|
@ -27,7 +19,6 @@ const navigate = ({ item, isMasterDetail, ...props }) => {
|
|||
roomUserId: RocketChat.getUidDirectMessage(item),
|
||||
...props
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const goRoom = async({ item = {}, isMasterDetail = false, ...props }) => {
|
||||
|
|
|
@ -50,7 +50,7 @@ class SelectedUsersView extends React.Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.init();
|
||||
|
||||
this.flatlist = React.createRef();
|
||||
const maxUsers = props.route.params?.maxUsers;
|
||||
this.state = {
|
||||
maxUsers,
|
||||
|
@ -190,9 +190,13 @@ class SelectedUsersView extends React.Component {
|
|||
if (users.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const ITEM_WIDTH = 250;
|
||||
return (
|
||||
<FlatList
|
||||
data={users}
|
||||
ref={ref => this.flatlist = ref}
|
||||
onContentSizeChange={() => this.flatlist.scrollToEnd()}
|
||||
getItemLayout={(_, index) => ({ length: ITEM_WIDTH, offset: ITEM_WIDTH * index, index })}
|
||||
keyExtractor={item => item._id}
|
||||
style={[sharedStyles.separatorTop, { borderColor: themes[theme].separatorColor }]}
|
||||
contentContainerStyle={{ marginVertical: 5 }}
|
||||
|
|
Loading…
Reference in New Issue