mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Revert "[MM-52547] Include current user profile in every redux action (#23219)"
This reverts commit a85c0b87b8
.
This commit is contained in:
parent
29466bd33a
commit
8f96888b1a
@ -35,6 +35,7 @@ import {getServerVersion} from 'mattermost-redux/selectors/entities/general';
|
||||
import {getCurrentUserId, getUsers} from 'mattermost-redux/selectors/entities/users';
|
||||
import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||
|
||||
import {removeUserFromList} from 'mattermost-redux/utils/user_utils';
|
||||
import {isMinimumServerVersion} from 'mattermost-redux/utils/helpers';
|
||||
import {General} from 'mattermost-redux/constants';
|
||||
|
||||
@ -214,10 +215,12 @@ export function getFilteredUsersStats(options: GetFilteredUsersStatsOpts = {}, u
|
||||
|
||||
export function getProfiles(page = 0, perPage: number = General.PROFILE_CHUNK_SIZE, options: any = {}): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let profiles: UserProfile[];
|
||||
|
||||
try {
|
||||
profiles = await Client4.getProfiles(page, perPage, options);
|
||||
removeUserFromList(currentUserId, profiles);
|
||||
} catch (error) {
|
||||
forceLogoutIfNecessary(error, dispatch, getState);
|
||||
dispatch(logError(error));
|
||||
@ -298,10 +301,12 @@ export function getProfilesByIds(userIds: string[], options?: any): ActionFunc {
|
||||
|
||||
export function getProfilesByUsernames(usernames: string[]): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let profiles;
|
||||
|
||||
try {
|
||||
profiles = await Client4.getProfilesByUsernames(usernames);
|
||||
removeUserFromList(currentUserId, profiles);
|
||||
} catch (error) {
|
||||
forceLogoutIfNecessary(error, dispatch, getState);
|
||||
dispatch(logError(error));
|
||||
@ -319,6 +324,7 @@ export function getProfilesByUsernames(usernames: string[]): ActionFunc {
|
||||
|
||||
export function getProfilesInTeam(teamId: string, page: number, perPage: number = General.PROFILE_CHUNK_SIZE, sort = '', options: any = {}): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let profiles;
|
||||
|
||||
try {
|
||||
@ -337,7 +343,7 @@ export function getProfilesInTeam(teamId: string, page: number, perPage: number
|
||||
},
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILES_LIST,
|
||||
data: profiles,
|
||||
data: removeUserFromList(currentUserId, [...profiles]),
|
||||
},
|
||||
]));
|
||||
|
||||
@ -407,6 +413,7 @@ export enum ProfilesInChannelSortBy {
|
||||
|
||||
export function getProfilesInChannel(channelId: string, page: number, perPage: number = General.PROFILE_CHUNK_SIZE, sort = '', options: {active?: boolean} = {}): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let profiles;
|
||||
|
||||
try {
|
||||
@ -425,7 +432,7 @@ export function getProfilesInChannel(channelId: string, page: number, perPage: n
|
||||
},
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILES_LIST,
|
||||
data: profiles,
|
||||
data: removeUserFromList(currentUserId, [...profiles]),
|
||||
},
|
||||
]));
|
||||
|
||||
@ -435,6 +442,7 @@ export function getProfilesInChannel(channelId: string, page: number, perPage: n
|
||||
|
||||
export function getProfilesInGroupChannels(channelsIds: string[]): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let channelProfiles;
|
||||
|
||||
try {
|
||||
@ -458,7 +466,7 @@ export function getProfilesInGroupChannels(channelsIds: string[]): ActionFunc {
|
||||
},
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILES_LIST,
|
||||
data: profiles,
|
||||
data: removeUserFromList(currentUserId, [...profiles]),
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -472,6 +480,7 @@ export function getProfilesInGroupChannels(channelsIds: string[]): ActionFunc {
|
||||
|
||||
export function getProfilesNotInChannel(teamId: string, channelId: string, groupConstrained: boolean, page: number, perPage: number = General.PROFILE_CHUNK_SIZE): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let profiles;
|
||||
|
||||
try {
|
||||
@ -492,7 +501,7 @@ export function getProfilesNotInChannel(teamId: string, channelId: string, group
|
||||
},
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILES_LIST,
|
||||
data: profiles,
|
||||
data: removeUserFromList(currentUserId, [...profiles]),
|
||||
},
|
||||
]));
|
||||
|
||||
@ -553,6 +562,7 @@ export function updateMyTermsOfServiceStatus(termsOfServiceId: string, accepted:
|
||||
|
||||
export function getProfilesInGroup(groupId: string, page = 0, perPage: number = General.PROFILE_CHUNK_SIZE, sort = ''): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let profiles;
|
||||
|
||||
try {
|
||||
@ -571,7 +581,7 @@ export function getProfilesInGroup(groupId: string, page = 0, perPage: number =
|
||||
},
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILES_LIST,
|
||||
data: profiles,
|
||||
data: removeUserFromList(currentUserId, [...profiles]),
|
||||
},
|
||||
]));
|
||||
|
||||
@ -581,6 +591,7 @@ export function getProfilesInGroup(groupId: string, page = 0, perPage: number =
|
||||
|
||||
export function getProfilesNotInGroup(groupId: string, page = 0, perPage: number = General.PROFILE_CHUNK_SIZE): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
let profiles;
|
||||
|
||||
try {
|
||||
@ -599,7 +610,7 @@ export function getProfilesNotInGroup(groupId: string, page = 0, perPage: number
|
||||
},
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILES_LIST,
|
||||
data: profiles,
|
||||
data: removeUserFromList(currentUserId, [...profiles]),
|
||||
},
|
||||
]));
|
||||
|
||||
@ -831,6 +842,9 @@ export function autocompleteUsers(term: string, teamId = '', channelId = '', opt
|
||||
}): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
dispatch({type: UserTypes.AUTOCOMPLETE_USERS_REQUEST, data: null});
|
||||
|
||||
const {currentUserId} = getState().entities.users;
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = await Client4.autocompleteUsers(term, teamId, channelId, options);
|
||||
@ -845,6 +859,7 @@ export function autocompleteUsers(term: string, teamId = '', channelId = '', opt
|
||||
if (data.out_of_channel) {
|
||||
users = [...users, ...data.out_of_channel];
|
||||
}
|
||||
removeUserFromList(currentUserId, users);
|
||||
const actions: AnyAction[] = [{
|
||||
type: UserTypes.RECEIVED_PROFILES_LIST,
|
||||
data: users,
|
||||
@ -887,6 +902,8 @@ export function autocompleteUsers(term: string, teamId = '', channelId = '', opt
|
||||
|
||||
export function searchProfiles(term: string, options: any = {}): ActionFunc {
|
||||
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
|
||||
let profiles;
|
||||
try {
|
||||
profiles = await Client4.searchUsers(term, options);
|
||||
@ -896,7 +913,7 @@ export function searchProfiles(term: string, options: any = {}): ActionFunc {
|
||||
return {error};
|
||||
}
|
||||
|
||||
const actions: AnyAction[] = [{type: UserTypes.RECEIVED_PROFILES_LIST, data: profiles}];
|
||||
const actions: AnyAction[] = [{type: UserTypes.RECEIVED_PROFILES_LIST, data: removeUserFromList(currentUserId, [...profiles])}];
|
||||
|
||||
if (options.in_channel_id) {
|
||||
actions.push({
|
||||
|
Loading…
Reference in New Issue
Block a user