diff --git a/src/components/elements/Stub.jsx b/src/components/elements/Stub.jsx
index 7fb036ee..8615c1e2 100644
--- a/src/components/elements/Stub.jsx
+++ b/src/components/elements/Stub.jsx
@@ -145,17 +145,15 @@ export const renderStubs = (the_group, to, username, accounts) => {
}
const { privacy } = the_group
- if (privacy !== 'public_group') {
- const { amBanned, amMember, amModer, amPending } = getRoleInGroup(the_group, username)
- const notMember = !amModer && !amMember
- if (amBanned || notMember) {
- composeStub = { ui: }
+ if (privacy === 'private_group') {
+ composeStub = { disabled: true }
+ msgsStub = { ui: }
- if (privacy === 'private_group') {
- composeStub = { disabled: true }
- msgsStub = { ui: }
- }
}
}
diff --git a/src/redux/FetchDataSaga.js b/src/redux/FetchDataSaga.js
index 13def8b3..8da81304 100644
--- a/src/redux/FetchDataSaga.js
+++ b/src/redux/FetchDataSaga.js
@@ -22,6 +22,19 @@ export function* watchFetchState() {
yield takeLatest('FETCH_STATE', fetchState)
}
+const setMiniAccount = (state, account) => {
+ if (account) {
+ state.accounts[account.name] = account
+ }
+}
+const addMiniAccounts = (state, accounts) => {
+ if (accounts) {
+ for (const [n, acc] of Object.entries(accounts)) {
+ setMiniAccount(state, acc)
+ }
+ }
+}
+
export function* fetchState(location_change_action) {
try {
@@ -59,8 +72,6 @@ export function* fetchState(location_change_action) {
const account = yield select(state => state.user.getIn(['current', 'username']));
if (account) {
- accounts.add(account);
-
const posting = yield select(state => state.user.getIn(['current', 'private_keys', 'posting_private']))
const path = parts[1]
@@ -75,6 +86,7 @@ export function* fetchState(location_change_action) {
...loginData,
owner: account, limit: 100,
cache: Object.keys(conCache),
+ accounts: true,
})
}
})
@@ -83,12 +95,13 @@ export function* fetchState(location_change_action) {
state.contacts = con.contacts
if (hasErr) return
console.timeEnd('prof: getContactsAsync')
+
+ addMiniAccounts(state, con.accounts)
}
if (path) {
if (path.startsWith('@')) {
const to = path.replace('@', '');
- accounts.add(to);
state.messages = yield callSafe(state, [], 'getThreadAsync', [api, api.getThreadAsync], account, to, {});
if (hasErr) return
@@ -139,11 +152,7 @@ export function* fetchState(location_change_action) {
thRes = yield call(getThread)
}
- if (thRes.accounts) {
- for (const [n, acc] of Object.entries(thRes.accounts)) {
- state.accounts[n] = acc
- }
- }
+ addMiniAccounts(state, thRes.accounts)
console.log('proc:' + thRes._dec_processed)
if (the_group && thRes.error) {
@@ -159,9 +168,6 @@ export function* fetchState(location_change_action) {
console.timeEnd('prof: getThreadAsync')
}
}
- for (let contact of state.contacts) {
- accounts.add(contact.contact);
- }
}
if (accounts.size > 0) {
@@ -295,6 +301,7 @@ export function* fetchGroupMembers({ payload: { group, creatingNew, memberTypes,
sort_conditions: sortConditions,
start_member: '',
limit: 100,
+ accounts: true,
})
yield put(g.actions.receiveGroupMembers({ group, members }))
diff --git a/src/redux/GlobalReducer.js b/src/redux/GlobalReducer.js
index f8dc6138..0d415b83 100644
--- a/src/redux/GlobalReducer.js
+++ b/src/redux/GlobalReducer.js
@@ -359,6 +359,16 @@ export default createModule({
})
return gro
})
+ for (const mem of (members || [])) {
+ if (mem.account_data) {
+ const account = fromJS(mem.account_data)
+ new_state = new_state.updateIn(
+ ['accounts', account.get('name')],
+ Map(),
+ a => a.mergeDeep(account)
+ )
+ }
+ }
return new_state
},
},