Add separator between DMs on your team and not (#2910)
Этот коммит содержится в:
@@ -152,6 +152,10 @@ func CreateDirectChannel(userId string, otherUserId string) (*model.Channel, *mo
|
|||||||
return nil, result.Err
|
return nil, result.Err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
message := model.NewMessage("", channel.Id, userId, model.ACTION_DIRECT_ADDED)
|
||||||
|
message.Add("teammate_id", otherUserId)
|
||||||
|
PublishAndForget(message)
|
||||||
|
|
||||||
return result.Data.(*model.Channel), nil
|
return result.Data.(*model.Channel), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const (
|
|||||||
ACTION_POST_DELETED = "post_deleted"
|
ACTION_POST_DELETED = "post_deleted"
|
||||||
ACTION_CHANNEL_DELETED = "channel_deleted"
|
ACTION_CHANNEL_DELETED = "channel_deleted"
|
||||||
ACTION_CHANNEL_VIEWED = "channel_viewed"
|
ACTION_CHANNEL_VIEWED = "channel_viewed"
|
||||||
|
ACTION_DIRECT_ADDED = "direct_added"
|
||||||
ACTION_NEW_USER = "new_user"
|
ACTION_NEW_USER = "new_user"
|
||||||
ACTION_USER_ADDED = "user_added"
|
ACTION_USER_ADDED = "user_added"
|
||||||
ACTION_USER_REMOVED = "user_removed"
|
ACTION_USER_REMOVED = "user_removed"
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ func (s SqlUserStore) GetEtagForDirectProfiles(userId string) StoreChannel {
|
|||||||
result := StoreResult{}
|
result := StoreResult{}
|
||||||
|
|
||||||
updateAt, err := s.GetReplica().SelectInt(`
|
updateAt, err := s.GetReplica().SelectInt(`
|
||||||
SELECT
|
SELECT
|
||||||
UpdateAt
|
UpdateAt
|
||||||
FROM
|
FROM
|
||||||
Users
|
Users
|
||||||
@@ -454,13 +454,14 @@ func (s SqlUserStore) GetEtagForDirectProfiles(userId string) StoreChannel {
|
|||||||
Channels.Type = 'D'
|
Channels.Type = 'D'
|
||||||
AND Channels.Id = ChannelMembers.ChannelId
|
AND Channels.Id = ChannelMembers.ChannelId
|
||||||
AND ChannelMembers.UserId = :UserId))
|
AND ChannelMembers.UserId = :UserId))
|
||||||
OR Id IN (SELECT
|
OR Id IN (SELECT
|
||||||
Name
|
Name
|
||||||
FROM
|
FROM
|
||||||
Preferences
|
Preferences
|
||||||
WHERE
|
WHERE
|
||||||
UserId = :UserId
|
UserId = :UserId
|
||||||
AND Category = 'direct_channel_show')
|
AND Category = 'direct_channel_show')
|
||||||
|
ORDER BY UpdateAt DESC
|
||||||
`, map[string]interface{}{"UserId": userId})
|
`, map[string]interface{}{"UserId": userId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Data = fmt.Sprintf("%v.%v", model.CurrentVersion, model.GetMillis())
|
result.Data = fmt.Sprintf("%v.%v", model.CurrentVersion, model.GetMillis())
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ function handleMessage(msg) {
|
|||||||
handleChannelDeletedEvent(msg);
|
handleChannelDeletedEvent(msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SocketEvents.DIRECT_ADDED:
|
||||||
|
handleDirectAddedEvent(msg);
|
||||||
|
break;
|
||||||
|
|
||||||
case SocketEvents.PREFERENCE_CHANGED:
|
case SocketEvents.PREFERENCE_CHANGED:
|
||||||
handlePreferenceChangedEvent(msg);
|
handlePreferenceChangedEvent(msg);
|
||||||
break;
|
break;
|
||||||
@@ -201,9 +205,15 @@ function handlePostDeleteEvent(msg) {
|
|||||||
|
|
||||||
function handleNewUserEvent() {
|
function handleNewUserEvent() {
|
||||||
AsyncClient.getProfiles();
|
AsyncClient.getProfiles();
|
||||||
|
AsyncClient.getDirectProfiles();
|
||||||
AsyncClient.getChannelExtraInfo();
|
AsyncClient.getChannelExtraInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDirectAddedEvent(msg) {
|
||||||
|
AsyncClient.getChannel(msg.channel_id);
|
||||||
|
AsyncClient.getDirectProfiles();
|
||||||
|
}
|
||||||
|
|
||||||
function handleUserAddedEvent(msg) {
|
function handleUserAddedEvent(msg) {
|
||||||
if (ChannelStore.getCurrentId() === msg.channel_id) {
|
if (ChannelStore.getCurrentId() === msg.channel_id) {
|
||||||
AsyncClient.getChannelExtraInfo();
|
AsyncClient.getChannelExtraInfo();
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ export default class Sidebar extends React.Component {
|
|||||||
const preferences = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW);
|
const preferences = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW);
|
||||||
|
|
||||||
const directChannels = [];
|
const directChannels = [];
|
||||||
|
const directNonTeamChannels = [];
|
||||||
for (const [name, value] of preferences) {
|
for (const [name, value] of preferences) {
|
||||||
if (value !== 'true') {
|
if (value !== 'true') {
|
||||||
continue;
|
continue;
|
||||||
@@ -117,10 +118,15 @@ export default class Sidebar extends React.Component {
|
|||||||
directChannel.teammate_id = teammateId;
|
directChannel.teammate_id = teammateId;
|
||||||
directChannel.status = UserStore.getStatus(teammateId);
|
directChannel.status = UserStore.getStatus(teammateId);
|
||||||
|
|
||||||
directChannels.push(directChannel);
|
if (UserStore.hasTeamProfile(teammateId)) {
|
||||||
|
directChannels.push(directChannel);
|
||||||
|
} else {
|
||||||
|
directNonTeamChannels.push(directChannel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
directChannels.sort(this.sortChannelsByDisplayName);
|
directChannels.sort(this.sortChannelsByDisplayName);
|
||||||
|
directNonTeamChannels.sort(this.sortChannelsByDisplayName);
|
||||||
|
|
||||||
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999);
|
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999);
|
||||||
|
|
||||||
@@ -130,6 +136,7 @@ export default class Sidebar extends React.Component {
|
|||||||
publicChannels,
|
publicChannels,
|
||||||
privateChannels,
|
privateChannels,
|
||||||
directChannels,
|
directChannels,
|
||||||
|
directNonTeamChannels,
|
||||||
unreadCounts: JSON.parse(JSON.stringify(ChannelStore.getUnreadCounts())),
|
unreadCounts: JSON.parse(JSON.stringify(ChannelStore.getUnreadCounts())),
|
||||||
showTutorialTip: tutorialStep === TutorialSteps.CHANNEL_POPOVER,
|
showTutorialTip: tutorialStep === TutorialSteps.CHANNEL_POPOVER,
|
||||||
currentTeam: TeamStore.getCurrent(),
|
currentTeam: TeamStore.getCurrent(),
|
||||||
@@ -496,6 +503,15 @@ export default class Sidebar extends React.Component {
|
|||||||
return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
|
return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const directMessageNonTeamItems = this.state.directNonTeamChannels.map((channel, index, arr) => {
|
||||||
|
return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
|
||||||
|
});
|
||||||
|
|
||||||
|
let directDivider;
|
||||||
|
if (directMessageNonTeamItems.length !== 0) {
|
||||||
|
directDivider = <hr/>;
|
||||||
|
}
|
||||||
|
|
||||||
// update the favicon to show if there are any notifications
|
// update the favicon to show if there are any notifications
|
||||||
if (this.lastBadgesActive !== this.badgesActive) {
|
if (this.lastBadgesActive !== this.badgesActive) {
|
||||||
var link = document.createElement('link');
|
var link = document.createElement('link');
|
||||||
@@ -675,6 +691,8 @@ export default class Sidebar extends React.Component {
|
|||||||
</h4>
|
</h4>
|
||||||
</li>
|
</li>
|
||||||
{directMessageItems}
|
{directMessageItems}
|
||||||
|
{directDivider}
|
||||||
|
{directMessageNonTeamItems}
|
||||||
{directMessageMore}
|
{directMessageMore}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -114,6 +114,14 @@ class UserStoreClass extends EventEmitter {
|
|||||||
return this.getProfile(userId) != null;
|
return this.getProfile(userId) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasTeamProfile(userId) {
|
||||||
|
return this.getProfiles()[userId];
|
||||||
|
}
|
||||||
|
|
||||||
|
hasDirectProfile(userId) {
|
||||||
|
return this.getDirectProfiles()[userId];
|
||||||
|
}
|
||||||
|
|
||||||
getProfile(userId) {
|
getProfile(userId) {
|
||||||
if (userId === this.getCurrentId()) {
|
if (userId === this.getCurrentId()) {
|
||||||
return this.getCurrentUser();
|
return this.getCurrentUser();
|
||||||
@@ -194,7 +202,7 @@ class UserStoreClass extends EventEmitter {
|
|||||||
const currentUser = this.profiles[currentId];
|
const currentUser = this.profiles[currentId];
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
if (currentId in this.profiles) {
|
if (currentId in this.profiles) {
|
||||||
delete this.profiles[currentId];
|
Reflect.deleteProperty(this.profiles, currentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.profiles = profiles;
|
this.profiles = profiles;
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ export default {
|
|||||||
POST_DELETED: 'post_deleted',
|
POST_DELETED: 'post_deleted',
|
||||||
CHANNEL_DELETED: 'channel_deleted',
|
CHANNEL_DELETED: 'channel_deleted',
|
||||||
CHANNEL_VIEWED: 'channel_viewed',
|
CHANNEL_VIEWED: 'channel_viewed',
|
||||||
|
DIRECT_ADDED: 'direct_added',
|
||||||
NEW_USER: 'new_user',
|
NEW_USER: 'new_user',
|
||||||
USER_ADDED: 'user_added',
|
USER_ADDED: 'user_added',
|
||||||
USER_REMOVED: 'user_removed',
|
USER_REMOVED: 'user_removed',
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user