remove unused types "starred" and "in-creation"

both are not used in productive:
- chat-id "in-creation" was dropped completely already in core-c
  as it does not allow assigning messages to chats in time.
- message flag "starred" was added at some point and never used.
  ux-wise, "disappearing messages" promises to clean up a chat -
  this does not fit well with "starring" messages.
  "saved messages" chat seems to be superior in that regard.
  but anyway, it is not used but comes at maintainance costs,
  so it is better to delete its functionality for now.
  (the db entries, however, are left for now,
  that might be more tricky to remove)
This commit is contained in:
B. Petersen
2020-10-03 13:13:04 +02:00
committed by holger krekel
parent a0c92753a9
commit 5405bfbc8d
7 changed files with 1 additions and 129 deletions

View File

@@ -92,13 +92,6 @@ impl ChatId {
self.0 == DC_CHAT_ID_TRASH
}
// DC_CHAT_ID_MSGS_IN_CREATION seems unused?
/// Virtual chat showing all starred messages.
pub fn is_starred(self) -> bool {
self.0 == DC_CHAT_ID_STARRED
}
/// Chat ID signifying there are **any** number of archived chats.
///
/// This chat ID can be returned in a [Chatlist] and signals to
@@ -508,8 +501,6 @@ impl std::fmt::Display for ChatId {
write!(f, "Chat#Deadrop")
} else if self.is_trash() {
write!(f, "Chat#Trash")
} else if self.is_starred() {
write!(f, "Chat#Starred")
} else if self.is_archived_link() {
write!(f, "Chat#ArchivedLink")
} else if self.is_alldone_hint() {
@@ -610,8 +601,6 @@ impl Chat {
let tempname = context.stock_str(StockMessage::ArchivedChats).await;
let cnt = dc_get_archived_cnt(context).await;
chat.name = format!("{} ({})", tempname, cnt);
} else if chat.id.is_starred() {
chat.name = context.stock_str(StockMessage::StarredMsgs).await.into();
} else {
if chat.typ == Chattype::Single {
let contacts = get_chat_contacts(context, chat.id).await;
@@ -1731,23 +1720,6 @@ pub async fn get_chat_msgs(
process_rows,
)
.await
} else if chat_id.is_starred() {
context
.sql
.query_map(
"SELECT m.id AS id, m.timestamp AS timestamp
FROM msgs m
LEFT JOIN contacts ct
ON m.from_id=ct.id
WHERE m.starred=1
AND m.hidden=0
AND ct.blocked=0
ORDER BY m.timestamp,m.id;",
paramsv![],
process_row,
process_rows,
)
.await
} else {
context
.sql

View File

@@ -118,10 +118,6 @@ pub const DC_OUTDATED_WARNING_DAYS: i64 = 365;
pub const DC_CHAT_ID_DEADDROP: u32 = 1;
/// messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again)
pub const DC_CHAT_ID_TRASH: u32 = 3;
/// a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be sent and shown)
pub const DC_CHAT_ID_MSGS_IN_CREATION: u32 = 4;
/// virtual chat showing all messages flagged with msgs.starred=2
pub const DC_CHAT_ID_STARRED: u32 = 5;
/// only an indicator in a chatlist
pub const DC_CHAT_ID_ARCHIVED_LINK: u32 = 6;
/// only an indicator in a chatlist

View File

@@ -263,7 +263,6 @@ pub struct Message {
pub(crate) server_folder: Option<String>,
pub(crate) server_uid: u32,
pub(crate) is_dc_message: MessengerMessage,
pub(crate) starred: bool,
pub(crate) chat_blocked: Blocked,
pub(crate) location_id: u32,
pub(crate) error: String,
@@ -307,7 +306,6 @@ impl Message {
" m.msgrmsg AS msgrmsg,",
" m.txt AS txt,",
" m.param AS param,",
" m.starred AS starred,",
" m.hidden AS hidden,",
" m.location_id AS location,",
" c.blocked AS blocked",
@@ -357,7 +355,6 @@ impl Message {
msg.text = Some(text);
msg.param = row.get::<_, String>("param")?.parse().unwrap_or_default();
msg.starred = row.get("starred")?;
msg.hidden = row.get("hidden")?;
msg.location_id = row.get("location")?;
msg.chat_blocked = row
@@ -582,10 +579,6 @@ impl Message {
self.state as i32 >= MessageState::OutDelivered as i32
}
pub fn is_starred(&self) -> bool {
self.starred
}
pub fn is_forwarded(&self) -> bool {
0 != self.param.get_int(Param::Forwarded).unwrap_or_default()
}
@@ -1303,23 +1296,6 @@ pub async fn update_msg_state(context: &Context, msg_id: MsgId, state: MessageSt
.is_ok()
}
pub async fn star_msgs(context: &Context, msg_ids: Vec<MsgId>, star: bool) -> bool {
if msg_ids.is_empty() {
return false;
}
context
.sql
.with_conn(move |conn| {
let mut stmt = conn.prepare("UPDATE msgs SET starred=? WHERE id=?;")?;
for msg_id in msg_ids.into_iter() {
stmt.execute(paramsv![star as i32, msg_id])?;
}
Ok(())
})
.await
.is_ok()
}
/// Returns a summary text.
pub async fn get_summarytext_by_raw(
viewtype: Viewtype,

View File

@@ -119,9 +119,6 @@ pub enum StockMessage {
#[strum(props(fallback = "Archived chats"))]
ArchivedChats = 40,
#[strum(props(fallback = "Starred messages"))]
StarredMsgs = 41,
#[strum(props(fallback = "Autocrypt Setup Message"))]
AcSetupMsgSubject = 42,