merging back topic alerts

This commit is contained in:
balzack 2023-03-03 17:45:30 -08:00
parent ace042bf0c
commit e57fb1b91d
4 changed files with 13 additions and 5 deletions

View File

@ -245,11 +245,11 @@ export function useChannelContext() {
},
setTopicFlag: async (channelId, topicId) => {
const { guid } = access.current;
await store.actions.setChannelTopicBlocked(guid, channelId, topicId, true);
await store.actions.setChannelTopicBlocked(guid, channelId, topicId, 1);
},
clearTopicFlag: async (channelId, topicId) => {
const { guid } = access.current;
await store.actions.setChannelTopicBlocked(guid, channelId, topicId, false);
await store.actions.setChannelTopicBlocked(guid, channelId, topicId, 0);
},
addChannelAlert: async (channelId) => {
const { server, guid } = access.current;

View File

@ -315,7 +315,8 @@ export function useConversationContext() {
else if (channelId) {
channel.actions.setTopicFlag(channelId, topicId);
}
setTopicField(topicId, 'blocked', true);
setTopicField(topicId, 'blocked', 1);
updateState({ topics: topics.current });
},
clearTopicFlag: async (topicId) => {
const { cardId, channelId } = conversationId.current || {};
@ -325,7 +326,8 @@ export function useConversationContext() {
else if (channelId) {
channel.actions.clearTopicFlag(channelId, topicId);
}
setTopicField(topicId, 'blocked', false);
setTopicField(topicId, 'blocked', 0);
updateState({ topics: topics.current });
},
getTopicAssetUrl: (topicId, assetId) => {
const { cardId, channelId } = conversationId.current || {};

View File

@ -129,6 +129,12 @@ export function useConversation() {
}
}
},
reportTopic: async (topicId) => {
await conversation.actions.addTopicAlert(topicId);
},
blockTopic: async (topicId) => {
await conversation.actions.setTopicFlag(topicId);
},
removeTopic: async (topicId) => {
await conversation.actions.removeTopic(topicId);
},

View File

@ -107,7 +107,7 @@ export function useBlockedMessages() {
unblock: async (cardId, channelId, topicId) => {
const id = `${cardId}:${channelId}:${topicId}`;
if (cardId) {
card.actions.clearChannelTopicFlag(cardId, channelId, topicId);
card.actions.clearTopicFlag(cardId, channelId, topicId);
}
else {
channel.actions.clearTopicFlag(channelId, topicId);